---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/openai_chat_completions/exceptions/variables/E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS.md
description: >-
  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`).
---

# Variable: E\_OPENAI\_CHAT\_COMPLETIONS\_INVALID\_TOOL\_CALL\_ARGS

```ts
const E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS: CreatedException<
  [string, string]
>;
```

Defined in: [src/batteries/llm/openai\_chat\_completions/exceptions.ts:108](https://github.com/NHTIO/ADK/blob/v1.20261003.0/src/src/batteries/llm/openai_chat_completions/exceptions.ts#L108)

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`).

## Remarks

Non-fatal. The adapter does NOT throw this — it instantiates it inside
`executeAndPersistToolCall`, pulls `.message` into a [@nhtio/adk!Tokenizable](../../../../../common/classes/Tokenizable.md), and persists a
`ToolCall` record with `isError: true`. The model sees the formatted message in the next
iteration's history and can self-correct. Consumers introspecting persisted error results
can match on the `E_OPENAI_CHAT_COMPLETIONS_INVALID_TOOL_CALL_ARGS` code substring.

Printf args: `[reasonHeadline, rawArgs]`.

* `reasonHeadline` — short reason such as `'are not valid JSON'` or
  `'must be a JSON object; received array'`.
* `rawArgs` — the raw `arguments` string the model emitted, echoed back verbatim so
  the model can see what it sent.
