You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] isNetworkError Checks Node Errno Codes on Wrong Property (error.name vs error.code) #737
The isNetworkError function checks error.name for Node.js system error codes such as ECONNREFUSED, ENOTFOUND, ECONNRESET, and ETIMEDOUT. In Node.js, these codes live on error.code, not error.name. The name property of a system error is always "Error". As a result, isNetworkError never returns true for actual Node network failures - only for the loose message-string matches further down the condition.
The same problem affects ETIMEDOUT in isTimeoutError.
Environment
OS: Any
Node version: Any (v18+)
Nanocoder version: Latest
Provider: Any network-facing provider (OpenRouter, OpenAI-compatible)
Model: Any
Steps to Reproduce
Configure a provider with an unreachable base URL.
Send a prompt and wait for the connection to be refused.
Inspect the ErrorInfo object returned by createErrorInfo().
Observe isNetworkError is false even though the error is ECONNREFUSED.
Expected Behavior
isNetworkError should return true when Node throws a system error with error.code === 'ECONNREFUSED' (or ENOTFOUND, ECONNRESET).
Actual Behavior
isNetworkError returns false because it checks error.name which is always "Error" for system errors, not the errno code.
Logs/Screenshots
N/A
Additional Context
Fix: replace error.name === 'ECONNREFUSED' with (error as NodeJS.ErrnoException).code === 'ECONNREFUSED' (and equivalents for ENOTFOUND, ECONNRESET, ETIMEDOUT).
Note: This issue is intentionally kept small and is suitable for first-time contributors. If you're interested in working on it, please leave a comment below and ask to be assigned before opening a pull request.
I have searched existing issues to ensure this is not a duplicate
I can reproduce this issue consistently
This issue occurs with the latest version of nanocoder
Hey @nightcityblade and @MsadafK, you both are already assigned to other issues. Could you please complete those first before taking on new ones? Thanks!
Activity
nightcityblade commentedon Aug 1, 2026
Hi, I'd like to work on this. Could you please assign it to me? I'll submit a focused fix with regression tests shortly.
MsadafK commentedon Aug 1, 2026
Hi @akramcodez , I would like to work on this issue. Please assign it to me!
akramcodez commentedon Aug 2, 2026
Hey @nightcityblade and @MsadafK, you both are already assigned to other issues. Could you please complete those first before taking on new ones? Thanks!
RealBhupesh commentedon Aug 2, 2026
I would like to work on this issue. I will include a focused fix and regression coverage in a PR shortly.