Skip to content

Print download error details when using concurrency#21818

Merged
Bo98 merged 1 commit intomainfrom
download-error-details
Mar 24, 2026
Merged

Print download error details when using concurrency#21818
Bo98 merged 1 commit intomainfrom
download-error-details

Conversation

@Bo98
Copy link
Copy Markdown
Member

@Bo98 Bo98 commented Mar 24, 2026

Right now, download errors have very limited usefulness when concurrency is enabled (the default):

$ brew fetch -s hello
✘ Formula hello (2.12.2)
Error: Failed to download resource "hello (2.12.2)"
Download failed: https://example.com/nonexistent

The behaviour without the queue was much more useful:

$ HOMEBREW_DOWNLOAD_CONCURRENCY=1 brew fetch -s hello
==> Downloading https://example.com/nonexistent
curl: (56) The requested URL returned error: 404                                

==> Retrying download in 2s... (1 try left)
==> Downloading https://example.com/nonexistent
curl: (56) The requested URL returned error: 404                                

Error: Failed to download resource "hello (2.12.2)"
Download failed: https://example.com/nonexistent

So let's fix up the concurrent version to display things like this:

$ brew fetch -s hello
✘ Formula hello (2.12.2)
Error: Failed to download resource "hello (2.12.2)"
Download failed: https://example.com/nonexistent
curl: (56) The requested URL returned error: 404 

Copilot AI review requested due to automatic review settings March 24, 2026 03:45
@Bo98 Bo98 force-pushed the download-error-details branch from 8cd5c79 to 6e811da Compare March 24, 2026 03:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the usefulness of fetch/download failures when Homebrew’s download concurrency queue is enabled by preserving relevant underlying error details (e.g., curl stderr) in the surfaced exception message.

Changes:

  • Extend CurlDownloadStrategyError to carry additional error “details” appended to the user-facing message.
  • Capture ErrorDuringExecution stderr in CurlDownloadStrategy#fetch and include it in the raised CurlDownloadStrategyError.
  • Include explicit details for specific failure paths (e.g., insecure redirect detection, Apache mirror JSON parse failure).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Library/Homebrew/exceptions.rb Modifies CurlDownloadStrategyError message construction to append error details.
Library/Homebrew/download_strategy.rb Propagates underlying stderr into CurlDownloadStrategyError to improve concurrent download failure output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@p-linnane p-linnane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks!

@Bo98 Bo98 force-pushed the download-error-details branch from 6e811da to 8177ecd Compare March 24, 2026 03:52
@Bo98 Bo98 force-pushed the download-error-details branch from 8177ecd to a5ac7d1 Compare March 24, 2026 04:06
@Bo98 Bo98 added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 53e35d4 Mar 24, 2026
40 checks passed
@Bo98 Bo98 deleted the download-error-details branch March 24, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants