{"record":{"id":"43e16f9f786fafd7","repo":"vercel/ai","slug":"tool-toolname-contains-an-invalid-caller","errorCode":null,"errorMessage":"tool \"${toolName}\" contains an invalid caller.","messagePattern":"tool \"(.+?)\" contains an invalid caller\\.","errorType":"validation","errorClass":"InvalidArgumentError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/generate-text/tool-caller-configuration.ts","lineNumber":66,"sourceCode":"    if (!Array.isArray(callers)) {\n      throw new InvalidArgumentError({\n        parameter: 'experimental_toolCallers',\n        value: toolCallers,\n        message: `callers for tool \"${toolName}\" must be an array.`,\n      });\n    }\n\n    resolved[toolName] = callers.map(caller => {\n      if (caller === DIRECT_TOOL_CALL) {\n        return caller;\n      }\n\n      if (\n        typeof caller !== 'string' ||\n        !Object.prototype.hasOwnProperty.call(tools, caller) ||\n        experimental_getToolCaller(tools[caller]) == null\n      ) {\n        throw new InvalidArgumentError({\n          parameter: 'experimental_toolCallers',\n          value: toolCallers,\n          message: `tool \"${toolName}\" contains an invalid caller.`,\n        });\n      }\n\n      return caller;\n    });\n  }\n\n  return resolved;\n}\n\nexport function prepareToolsForToolCallers({\n  tools,\n  toolCallers,\n}: {\n  tools: ToolSet | undefined;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/generate-text/tool-caller-configuration.ts#L48-L84","documentation":"Every entry in a toolCallers array must itself be the name of an existing tool that exposes a caller (experimental_getToolCaller must return a value). resolveToolCallerConfiguration throws this InvalidArgumentError when a caller string is not a string, does not name a defined tool, or names a tool without a configured caller.","triggerScenarios":"Passing `experimental_toolCallers: { myTool: ['notATool'] }` where 'notATool' is missing from tools, is a non-string value, or is a tool that has no getToolCaller implementation (not itself callable as a caller).","commonSituations":"Listing an agent/model tool that wasn't included in the tools map; listing a plain function tool that cannot act as a caller; typos in the caller name; circular or self references that are not caller-capable tools.","solutions":["Ensure each caller string names a tool present in `tools` that defines a tool caller implementation.","Fix typos in the caller name.","Add the caller tool to the tools map of the same call.","Only mark caller-capable tools (e.g. agent tools with experimental tool caller support) as callers."],"exampleFix":"// before\nstreamText({\n  tools: { summarize },\n  experimental_toolCallers: { summarize: ['summarizerAgent'] }, // summarizerAgent not in tools\n});\n\n// after\nstreamText({\n  tools: { summarize, summarizerAgent },\n  experimental_toolCallers: { summarize: ['summarizerAgent'] },\n});","handlingStrategy":"validation","validationCode":"function validateCallerEntries(tools: Record<string, unknown>, toolCallers: Record<string, string[]>) {\n  for (const [name, callers] of Object.entries(toolCallers)) {\n    for (const caller of callers) {\n      if (typeof caller !== 'string' || !(caller in tools)) {\n        throw new Error(`tool \"${name}\" references invalid caller \"${String(caller)}\"`);\n      }\n    }\n  }\n}","typeGuard":"function isKnownCaller<K extends string>(tools: Record<K, unknown>, caller: unknown): caller is K {\n  return typeof caller === 'string' && caller in tools;\n}","tryCatchPattern":"try {\n  await generateText({ tools, experimental_toolCallers, ... });\n} catch (error) {\n  if (InvalidArgumentError.isInstance(error) && /invalid caller/.test(error.message)) {\n    console.error('Caller must be an existing caller-capable tool:', error.message);\n  } else throw error;\n}","preventionTips":["Only list tools that both exist in `tools` and implement a tool caller (agent tools).","Keep caller names in a shared const object with the tools map.","Add a startup-time consistency test for your tool + caller configuration."],"tags":["tools","configuration","invalid-argument"],"backgroundTag":"unknown-tool-name","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}