Skip to content

fix(cli): say why an upload failed - #1357

Merged
trunk-io[bot] merged 1 commit into
mainfrom
tylerbeebe/print-the-upload-error
Nov 17, 2026
Merged

trunk-io[bot] merged 1 commit into
mainfrom
tylerbeebe/print-the-upload-error

Conversation

@acatxnamedvirtue

Copy link
Copy Markdown
Contributor

Problem

When an upload fails, the CLI prints "There was an unexpected error that occurred while uploading test results". Beneath that it printed only Trunk's explanation, and only when Trunk's API gave one. Every other error left a blank line where the reason belongs, in the text summary and in the GitHub annotation alike.

Found on 1.0.0-beta.1 in the flake farm (trunk-io/flake-farm-staging-fork-prs#6188). There, --allow-forked-pr-uploads on a pull request that isn't from a fork printed:

Error Encountered
There was an unexpected error that occurred while uploading test results

For more help, contact us at https://slack.trunk.io/

The CLI had the right message, "…uploads only from a GitHub Actions run of a pull request from a fork…", but dropped it. UPGRADING.md promises that this case "uploads nothing and says why".

Change

  • ErrorSummary::reason() returns Trunk's explanation when there is one. Otherwise it returns the error with its causes, joined with : the way anyhow's {:#} joins them.
  • text::render_error and the GitHub annotation's error_message print reason() beneath the base message.
  • Unchanged:
    • errors without a base message;
    • the connection-refused and unauthorized branches;
    • the JSON summary, which already carries error and causes.

The same case now prints:

Error Encountered
There was an unexpected error that occurred while uploading test results

Error in create bundle upload endpoint: --allow-forked-pr-uploads without a Trunk API token uploads only from a GitHub Actions run of a pull request from a fork; test results will not be uploaded.

For more help, contact us at https://slack.trunk.io/

Testing

  • New prints_the_error_and_its_causes_beneath_the_base_message (text) and warns_with_the_reason_an_upload_failed (annotation).
  • The trunk-analytics-cli and test_report suites pass locally, except the three Swift xunit tests, which need a Swift toolchain this machine doesn't have.
  • Ran the built CLI with --allow-forked-pr-uploads and no token outside a fork PR; output is above.
  • trunk check is clean. The clippy warnings in the touched test file predate this change.

🤖 Generated with Claude Code

An upload error with a base message ("There was an unexpected error
that occurred while uploading test results") printed only Trunk's
explanation beneath it, so an error with none, such as
--allow-forked-pr-uploads outside a fork pull request, printed a blank
line where the reason belongs, in the summary and in the GitHub
annotation alike. Print the error and its causes in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@codecov-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.81%. Comparing base (26ec370) to head (520934d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1357      +/-   ##
==========================================
+ Coverage   85.61%   85.81%   +0.19%     
==========================================
  Files          85       85              
  Lines       19174    19180       +6     
==========================================
+ Hits        16416    16459      +43     
+ Misses       2758     2721      -37     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trunk-io
trunk-io Bot merged commit 7eca7f8 into main Nov 17, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants