Ultimate

X_LLM_TOOL_ARGUMENTS_INVALID

Means

a finished turn called a tool with arguments that are not JSON

Typical cause

the model completed its turn (the stop reason is not a truncation) and the argument string of a tool call does not parse — or streamed fragments carried no index and no id, so two calls could not be told apart. The provider answered and billed: meta.billed carries the usage and cost, the gateway records them on the ledger and does not retry. A turn cut off mid-arguments is X_LLM_TRUNCATED instead. terminal for a job: it dead-letters on the first attempt

Fix

maxTokens: 8192 on the llm() / agent() declaration if the arguments were long, and shorten or split the string fields of the tool's input schema; to run the same request once more, catch the code in the job and re-enqueue it deliberately — a retry policy does not apply

Listed under MCP and AI

This page as markdown