{"record":{"id":"c58713a7a7113f49","repo":"BerriAI/litellm","slug":"allowed-callers-must-be-a-list-of-strings","errorCode":null,"errorMessage":"allowed_callers must be a list of strings","messagePattern":"allowed_callers must be a list of strings","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/chat/transformation.py","lineNumber":825,"sourceCode":"                    returned_tool[\"defer_loading\"] = _defer_loading_function\n\n        ## check if allowed_callers is set in the tool\n        _allowed_callers: Final = tool.get(\"allowed_callers\", None)\n        _allowed_callers_function: Final = tool.get(\"function\", {}).get(\"allowed_callers\", None)\n        if returned_tool is not None:\n            # Only set allowed_callers on tools that support it (not tool search tools or computer tools)\n            tool_type = returned_tool.get(\"type\", \"\")\n            if tool_type not in (\n                \"tool_search_tool_regex_20251119\",\n                \"tool_search_tool_bm25_20251119\",\n                \"computer_20241022\",\n                \"computer_20250124\",\n            ):\n                if _allowed_callers is not None:\n                    if not isinstance(_allowed_callers, list) or not all(\n                        isinstance(item, str) for item in _allowed_callers\n                    ):\n                        raise ValueError(\"allowed_callers must be a list of strings\")\n                    returned_tool[\"allowed_callers\"] = _allowed_callers\n                elif _allowed_callers_function is not None:\n                    if not isinstance(_allowed_callers_function, list) or not all(\n                        isinstance(item, str) for item in _allowed_callers_function\n                    ):\n                        raise ValueError(\"allowed_callers must be a list of strings\")\n                    returned_tool[\"allowed_callers\"] = _allowed_callers_function\n\n        ## check if input_examples is set in the tool\n        _input_examples: Final = tool.get(\"input_examples\", None)\n        _input_examples_function: Final = tool.get(\"function\", {}).get(\"input_examples\", None)\n        if returned_tool is not None:\n            # Only set input_examples on user-defined tools (type \"custom\" or no type)\n            tool_type = returned_tool.get(\"type\", \"\")\n            if tool_type == \"custom\" or (tool_type == \"\" and \"name\" in returned_tool):\n                if _input_examples is not None and isinstance(_input_examples, list):\n                    returned_tool[\"input_examples\"] = _input_examples\n                elif _input_examples_function is not None and isinstance(_input_examples_function, list):","sourceCodeStart":807,"sourceCodeEnd":843,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/anthropic/chat/transformation.py#L807-L843","documentation":"Tool-mapping guard in the Anthropic chat transformation: allowed_callers was set on a tool but is not a list of strings; the Anthropic API (code-execution/MCP tools) requires allowed_callers to be a str list, so the value is rejected before sending.","triggerScenarios":"Thrown at litellm/llms/anthropic/chat/transformation.py:825 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass allowed_callers as a list of strings, e.g. ['direct']."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}