Skip to content

fix(utils): classify validation errors strictly over network substring heuristics - #1155

Open
MsfPablo wants to merge 1 commit into
Nano-Collective:mainfrom
MsfPablo:fix/error-formatter-strict-validation
Open

fix(utils): classify validation errors strictly over network substring heuristics#1155
MsfPablo wants to merge 1 commit into
Nano-Collective:mainfrom
MsfPablo:fix/error-formatter-strict-validation

Conversation

@MsfPablo

@MsfPablo MsfPablo commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

createErrorInfo misclassified validation errors as network errors when the message happened to contain a network-sounding substring like connection or fetch (#1136). The isNetworkError / isTimeoutError helpers match on loose .includes() substrings, so a message such as "validation failed for connection" was flagged as both a validation and a network error.

Validation now takes strict precedence over the network/timeout substring heuristics: when an error is a validation error, isNetworkError and isTimeoutError are forced to false. Real network errors (identified by error code such as ECONNREFUSED / ETIMEDOUT, or messages without a validation cue) are unaffected.

Behavior

message before after
validation failed for connection validation + network validation only
failed to fetch: connection refused network network
request failed + code: ETIMEDOUT network + timeout network + timeout

Testing

  • Added two regression specs covering the overlapping-message case and a real network error without a validation cue.
  • pnpm run test:types clean; error-formatter.spec.ts 28/28 in isolation; biome clean.
  • Existing createErrorInfo network/timeout specs continue to pass.

Closes #1136.

…g heuristics

createErrorInfo flagged a validation message containing "connection" or
"fetch" as both a validation and a network error, because isNetworkError
matched on loose .includes() substrings. Validation now takes strict
precedence over the network/timeout substring checks.

Closes Nano-Collective#1136.
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.

[Bug] error-formatter.ts substring classification of errors

1 participant