@nhtio/adk/batteries/llm/openai_chat_completions/exceptions
Battery-scoped exception constructors for OpenAI Chat Completions adapter failures.
Remarks
Battery-scoped exception classes for the OpenAI Chat Completions adapter. These exceptions are owned by the battery (not the ADK core) and are minted via createException from @nhtio/adk/factories. Re-exported from the battery's barrel.
Variables
| Variable | Description |
|---|---|
| E_INVALID_OPENAI_CHAT_COMPLETIONS_OPTIONS | Thrown when the resolved adapter options (constructor, executor overrides, or per-dispatch stash.openaiChatCompletions) fail validation against openAIChatCompletionsOptionsSchema. |
| E_OPENAI_CHAT_COMPLETIONS_CONTEXT_OVERFLOW | Thrown when the total token weight of the resolved request exceeds contextWindow. Only raised when tokenEncoding is non-null. Carries { total, contextWindow, tokenEncoding, perBucket } in the message so middleware can target shedding. |
| E_OPENAI_CHAT_COMPLETIONS_HTTP_ERROR | Thrown when the upstream Chat Completions endpoint returns a non-2xx response. Non-fatal — surfaced via ctx.nack(...) so middleware can decide retry / fail. |
| E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS | Raised when a tool-call's arguments string emitted by the model is not a JSON object — either non-parseable JSON, or parseable JSON whose root is not an object (e.g. a bare string, number, array, or null). |
| E_OPENAI_CHAT_COMPLETIONS_REQUEST_TIMEOUT | Thrown when the initial request handshake (TCP connect, TLS, response headers) does not complete before requestTimeoutMs. Non-fatal — surfaced via ctx.nack(...). Eligible for retry on the same footing as a retriable 5xx. |
| E_OPENAI_CHAT_COMPLETIONS_STREAM_ERROR | Thrown when the SSE stream emits a malformed chunk or the transport throws mid-stream. Non-fatal — surfaced via ctx.nack(...). |
| E_OPENAI_CHAT_COMPLETIONS_STREAM_STALLED | Thrown when the SSE stream goes silent for longer than streamIdleTimeoutMs. Non-fatal — surfaced via ctx.nack(...) with partial-state details so middleware can recover. |
| E_UNSUPPORTED_MEDIA_MODALITY | Raised when a @nhtio/adk!Media instance whose modality cannot be natively represented in the OpenAI Chat Completions wire format reaches the adapter under unsupportedMediaPolicy: 'throw'. |