{"record":{"id":"726d642c370bba1b","repo":"alibaba/page-agent","slug":"invalid-tool-args-726d64","errorCode":"INVALID_TOOL_ARGS","errorMessage":"No tool call arguments found","messagePattern":"No tool call arguments found","errorType":"exception","errorClass":"InvokeError","httpStatus":null,"severity":"error","filePath":"packages/llms/src/OpenAIClient.ts","lineNumber":204,"sourceCode":"\t\t\t\tundefined,\n\t\t\t\tdata\n\t\t\t)\n\t\t}\n\n\t\tconst tool = tools[toolCallName]\n\t\tif (!tool) {\n\t\t\tthrow new InvokeError(\n\t\t\t\tInvokeErrorTypes.UNKNOWN,\n\t\t\t\t`Tool \"${toolCallName}\" not found in tools`,\n\t\t\t\tundefined,\n\t\t\t\tdata\n\t\t\t)\n\t\t}\n\n\t\t// Extract and parse tool arguments\n\t\tconst argString = normalizedChoice.message?.tool_calls?.[0]?.function?.arguments\n\t\tif (!argString) {\n\t\t\tthrow new InvokeError(\n\t\t\t\tInvokeErrorTypes.INVALID_TOOL_ARGS,\n\t\t\t\t'No tool call arguments found',\n\t\t\t\tundefined,\n\t\t\t\tdata\n\t\t\t)\n\t\t}\n\n\t\tlet parsedArgs: unknown\n\t\ttry {\n\t\t\tparsedArgs = JSON.parse(argString)\n\t\t} catch (error) {\n\t\t\tthrow new InvokeError(\n\t\t\t\tInvokeErrorTypes.INVALID_TOOL_ARGS,\n\t\t\t\t'Failed to parse tool arguments as JSON',\n\t\t\t\terror,\n\t\t\t\tdata\n\t\t\t)\n\t\t}","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/alibaba/page-agent/blob/d02db1ee7c41f5315beda88bab2fe935c580f662/packages/llms/src/OpenAIClient.ts#L186-L222","documentation":"The chosen tool call has no function.arguments string on the response, so there is nothing to parse into tool input; invoke() throws InvokeError INVALID_TOOL_ARGS. Some providers omit arguments entirely (rather than sending '{}') when a tool takes no parameters.","triggerScenarios":"invoke() returns a tool_call whose function.arguments is undefined/null/empty; typical for zero-argument tools on OpenAI-compatible providers, or providers that put arguments under a different field.","commonSituations":"Open-source model servers (Ollama/vLLM variants) that omit arguments for parameterless tools; a normalizeResponse that drops the field; schema-less tool definitions leading the model to skip arguments.","solutions":["Inspect error.data.choices[0].message.tool_calls[0] to confirm arguments is missing","Give the tool a schema (even an empty-object schema with additionalProperties:false) so the model emits '{}'","Use normalizeResponse to default missing arguments to '{}' before parsing"],"exampleFix":"// before\nconst result = await llm.invoke(messages, tools)\n\n// after\nconst result = await llm.invoke(messages, tools, {\n  normalizeResponse: (data) => {\n    const tc = data.choices?.[0]?.message?.tool_calls?.[0]\n    if (tc && !tc.function?.arguments) tc.function.arguments = '{}'\n    return data\n  },\n})","handlingStrategy":"fallback","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  await llm.invoke(messages, tools)\n} catch (e) {\n  if (e instanceof InvokeError && e.code === InvokeErrorTypes.INVALID_TOOL_ARGS && /No tool call arguments/.test(e.message)) {\n    // provider omitted arguments for a zero-arg tool; retry with normalizeResponse defaulting to '{}'\n  }\n}","preventionTips":["Always give tools an explicit inputSchema, even zero-arg ones","Use normalizeResponse to default missing arguments to '{}'","Smoke-test each new provider with a zero-arg tool"],"tags":["llm","tool-calling","tool-arguments","invalid-args"],"backgroundTag":"llm-missing-tool-arguments","analyzedSha":"d02db1ee7c41f5315beda88bab2fe935c580f662","analyzedAt":"2026-08-28T19:39:48.634Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}