Network Error Classifier (reliability/network-error.ts)

atomic-agent · src/llm/reliability/network-error.ts · typescript · MIT
ai, infra, tag:error, tag:classification, tag:reliability

Identifies raw network failures (e.g., dropped connections, socket errors) from untyped runtime exceptions. Use when you need to differentiate network issues from application errors.

// Source: https://github.com/AtomicBot-ai/atomic-agent | License: MIT | Copyright 2026 Atomic Bot
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Recognition of raw network failures that reach the runtime *untyped*.
 *
 * `LlamaServerClient` and the OpenAI HTTP client both wrap their own
 * failures into `LlamaServerError` / `OpenAiHttpError`, so the classifier
 * can read a status off them. Everything else that talks HTTP — MCP
 * streamable-http transports, embedding calls, vendor SDKs that bring
 * their own `fetch` — throws whatever `undici` threw: a bare
 * `TypeError: fetch failed` whose `cause` carries the real errno, or an
 * `Error: terminated` when the socket dies mid-body.
 *
 * Without this recognition those land in `classifyFailure`'s catch-all
 * and 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key