Skip to content
2 min read · 362 words

@nhtio/adk/batteries/llm/openai_responses/exceptions

Battery-scoped exception constructors for the OpenAI Responses adapter.

Remarks

Battery-scoped exception classes for the OpenAI Responses 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. The status codes and fatal split mirror the sibling openai_chat_completions and anthropic_messages batteries.

Variables

VariableDescription
E_INVALID_OPENAI_RESPONSES_OPTIONSThrown when the resolved adapter options (constructor, executor overrides, or per-dispatch stash.openaiResponses) fail validation against openAIResponsesOptionsSchema.
E_OPENAI_RESPONSES_CONTEXT_OVERFLOWThrown 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_RESPONSES_HTTP_ERRORThrown when the upstream Responses endpoint returns a non-2xx response. Non-fatal — surfaced via ctx.nack(...) so middleware can decide retry / fail.
E_OPENAI_RESPONSES_INVALID_TOOL_CALL_ARGSRaised 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_RESPONSES_REASONING_REPLAY_REJECTEDThrown when the upstream Responses API rejects the request because a replayed reasoning item violates the undocumented reasoning/output-item pairing constraint (openai/openai-node#1791) — detected by matching the upstream error body against known phrases (e.g. "of type 'reasoning' was provided without" / "Items are not persisted when store is set to false").
E_OPENAI_RESPONSES_REQUEST_TIMEOUTThrown 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_RESPONSES_STREAM_ERRORThrown when the SSE stream emits a malformed chunk, the transport throws mid-stream, or an explicit upstream response.failed / error terminal event arrives.
E_OPENAI_RESPONSES_STREAM_STALLEDThrown 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_OPENAI_RESPONSES_UNSUPPORTED_MEDIA_MODALITYRaised when a @nhtio/adk!Media instance whose modality cannot be natively represented in the OpenAI Responses wire format reaches the adapter under unsupportedMediaPolicy: 'throw'.