Repository navigation
fix(http-client): name a connection that failed on every address - #705
Merged
Merged
Conversation
With autoSelectFamily, a connect that fails on every address is an AggregateError with an empty message, and node-fetch reports it as "request to <url> failed, reason: " with nothing after the colon. Its code survives on the FetchError: name it in the message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
An active moderate finding remains because the test relies on a Node option whose default differs across supported Node versions, causing failures and incomplete error coverage on older versions.
1 open issue
What changed in this PR
Improves shared HTTP client diagnostics when connection attempts fail on every resolved address, while preserving connection-error classification for retries.
Changes:
- Fills empty connection-error reasons with the error code.
- Adds a dual-address failure regression test.
- Records a patch release change.
| File | Description |
|---|---|
util/http-client/src/client.ts |
Adds descriptive text to empty connection failures. |
util/http-client/src/client.connect-error.test.ts |
Checks error text and retry classification. |
common/changes/@subsquid/http-client/fix-http-client-empty-connect-reason_2026-12-05-00-00.json |
Records the diagnostic fix for release. |
Review effort: Lite
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem. With
autoSelectFamily, Node's default since version 20, a connection that fails on every address the host resolves to raises anAggregateError, and its message is empty. node-fetch keeps only the error'scodeand builds the message from that empty text, so the log reads:Nothing after the colon. Slow Portal head requests in fallback live runs logged exactly this. Reading them needed a reproduction, which showed the code was
ETIMEDOUTand that every connection attempt had failed.Fix. The client fills in the empty reason from the code the
FetchErrorstill carries:… failed, reason: connect ETIMEDOUT on every address the host resolves to. The message still starts withrequest to, so it is still classified as a connection error and retried (the test checksisHttpConnectionError). The Portal client, the RPC client and anything else built on@subsquid/http-clientgets the clearer message.Test:
client.connect-error.test.ts. A custom lookup resolves the host to closed ports on127.0.0.1and::1, which gives a deterministicECONNREFUSEDon both families. The test fails without the fix. http-client tests pass (6) andtsc --noEmitis clean.🤖 Generated with Claude Code