ai.errors.normalize
The classifying gate at every client boundary. Nothing is wrapped in UnknownError here: each raw infrastructure type maps to a typed Failure, and UnknownError only passes through when a host boundary already produced one. Classifications: InvalidArgument / ParseError / baml.json.SerializationError / AccessError / Unsupported -> InvalidRequest (request construction or client configuration bug; not retryable) Io -> NetworkFailure (transport-adjacent; safely retryable) baml.json.ParseError / baml.json.DecodeError -> NetworkFailure (malformed provider wire payload; safely retryable) Timeout / CompilationError / Failure / UnknownError -> as-is
Signature
The classifying gate at every client boundary. Nothing is wrapped in UnknownError here: each raw infrastructure type maps to a typed Failure, and UnknownError only passes through when a host boundary already produced one. Classifications: InvalidArgument / ParseError / baml.json.SerializationError / AccessError / Unsupported -> InvalidRequest (request construction or client configuration bug; not retryable) Io -> NetworkFailure (transport-adjacent; safely retryable) baml.json.ParseError / baml.json.DecodeError -> NetworkFailure (malformed provider wire payload; safely retryable) Timeout / CompilationError / Failure / UnknownError -> as-is
Source:<builtin>/ai/ns_errors/errors.bamlbytes 2403–5007