← Back to Pull requests

Give node:net's rejected connect hosts Node's ENOTFOUND properties #8648

Closed
unknown closed this pull request without merging on Nov 19, 2026 07:41 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 06:28 UTC
Author

node:net reports connect failures with Node's errno codes, but not a host that cloudflare:sockets refuses before it connects. If the address check rejects a host name, for example net.connect(0, 'invalid address') or a name with a character outside [A-Za-z0-9._:[]-], connect() throws a TypeError that reaches the 'error' listener with no code, syscall or hostname:

net.connect(0, 'invalid address').on('error', (err) => console.log(err.code));
// Node: ENOTFOUND (syscall 'getaddrinfo', hostname 'invalid address')
// workerd: undefined ("Specified address could not be parsed.")

Node's getaddrinfo fails with ENOTFOUND for these hosts, and libraries branch on err.code.

In this patch that TypeError gains code: 'ENOTFOUND', errno, syscall: 'getaddrinfo' and hostname. It is reported through 'lookup' before 'error', as an unresolvable host already is. Node never looks up an IP literal, so an IP literal that connect() rejects, like fe80::1%eth0, keeps the platform's error. The error's type and message don't change, so this ships without a compatibility flag.

The port of test-net-better-error-messages-port-hostname now asserts these properties for both kinds of rejected name, and it fails without the fix. A new case covers the IP literal. The port of test-net-dns-error awaited the resolver objects instead of their promises, so its 'lookup' assertions never ran. It now waits for them and matches upstream.

Diff: 183 lines (+137 / -46) across 2 files Reviewer: littledivy Review duration: 72m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 183 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.312
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8648"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35.6% (MEDIUM) · Higher = larger blast radius
35.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.1% · Safe to merge
14.1%