Repository navigation
Conversation
The error had the message of a DNS failure but no code, so consumers that name errors by code saw a bare Error. Co-Authored-By: Claude <noreply@anthropic.com>
Kart03
marked this pull request as ready for review
October 26, 2026 13:08
Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (34.09%) is below the target coverage (35.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #1572 +/- ##
===========================================
+ Coverage 77.72% 77.84% +0.11%
===========================================
Files 51 51
Lines 4369 4373 +4
Branches 1234 1234
===========================================
+ Hits 3396 3404 +8
+ Misses 730 725 -5
- Partials 243 244 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Member
|
I don’t think we should make this change.
|
Contributor
Author
|
Agreed, thanks. A blocked address isn't a DNS failure, and the NETERR: prefix already marks it. Closing this; I'll classify it on our side using that prefix. |
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.
Context
A request blocked by
network.restrictedAddressesfails with anErrorwhose message isNETERR: getaddrinfo ENOTFOUND <host>, the same wording as a real DNS failure, but with nocode. A real DNS failure from Node carriescode: 'ENOTFOUND'. Consumers that name or group errors bycodetherefore see a bareErrorfor blocked addresses and can't treat them like other host-not-found failures.Summary of the change
The error is now built in one place,
restrictedAddressError(hostname)inlib/requester/core.js, and setscode = 'ENOTFOUND'. It replaces the five places that built it by hand: the pre-request hostname check inrequester.js, the two DNS lookup paths, the*.localhostcheck, and the redirect listener. The message is unchanged, so anything matching on it keeps working.I used
ENOTFOUNDrather than a new code so the error matches what its message already says and exposes nothing new about why the request was blocked.Breaking changes
None.
error.codegoes fromundefinedto'ENOTFOUND'on these errors only. Code that checkserror.code === undefinedto spot blocked addresses would change. Not checked for in dependents.Dependencies
None.
Test plan
npx mocha test/unit/requester-core.test.jsnpm run test-integrationcodeassertion on a blocked addressThe new assertions are on existing tests: the redirect listener (unit) and a request to a restricted IP (integration). Not checked: lint. The repo's ESLint config conflicts with a parent config in the worktree I ran it from.
Additional notes
Changelog entry added under
unreleased.Generated with Claude Code