BerriAI/litellm · error · ValueError
allowed_callers must be a list of strings
Error message
allowed_callers must be a list of strings
What it means
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.
Solutions
- Pass allowed_callers as a list of strings, e.g. ['direct'].
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at litellm/llms/anthropic/chat/transformation.py:825 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/c58713a7a7113f49.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/anthropic/chat/transformation.py:825
returned_tool["defer_loading"] = _defer_loading_function
## check if allowed_callers is set in the tool
_allowed_callers: Final = tool.get("allowed_callers", None)
_allowed_callers_function: Final = tool.get("function", {}).get("allowed_callers", None)
if returned_tool is not None:
# Only set allowed_callers on tools that support it (not tool search tools or computer tools)
tool_type = returned_tool.get("type", "")
if tool_type not in (
"tool_search_tool_regex_20251119",
"tool_search_tool_bm25_20251119",
"computer_20241022",
"computer_20250124",
):
if _allowed_callers is not None:
if not isinstance(_allowed_callers, list) or not all(
isinstance(item, str) for item in _allowed_callers
):
raise ValueError("allowed_callers must be a list of strings")
returned_tool["allowed_callers"] = _allowed_callers
elif _allowed_callers_function is not None:
if not isinstance(_allowed_callers_function, list) or not all(
isinstance(item, str) for item in _allowed_callers_function
):
raise ValueError("allowed_callers must be a list of strings")
returned_tool["allowed_callers"] = _allowed_callers_function
## check if input_examples is set in the tool
_input_examples: Final = tool.get("input_examples", None)
_input_examples_function: Final = tool.get("function", {}).get("input_examples", None)
if returned_tool is not None:
# Only set input_examples on user-defined tools (type "custom" or no type)
tool_type = returned_tool.get("type", "")
if tool_type == "custom" or (tool_type == "" and "name" in returned_tool):
if _input_examples is not None and isinstance(_input_examples, list):
returned_tool["input_examples"] = _input_examples
elif _input_examples_function is not None and isinstance(_input_examples_function, list):View on GitHub (pinned to 77b7c6c40c)