BerriAI/litellm · error · HTTPException

Invalid display name '{display_name}' for tool '{original_na

Error message

Invalid display name '{display_name}' for tool '{original_name}'. Display names may only contain letters, digits, underscores, and hyphens (no spaces or other special characters), since they replace the tool name sent to the LLM provider.

What it means

Error "Invalid display name '{display_name}' for tool '{original_name}'. Display names may only contain letters, digits, underscores, and hyphens (no spaces or other special characters), since they replace the tool name sent to the LLM provider." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/_experimental/mcp_server/utils.py:599

    Validate tool display name overrides against Bedrock's tool-name constraint.

    A display name replaces the tool name sent to the LLM provider, so it must
    satisfy the strictest provider requirement in use (Bedrock's
    ``[a-zA-Z0-9_-]+``); a name with spaces or other characters saves
    successfully but fails every subsequent Bedrock tool call.

    Raises:
        HTTPException: If any display name fails the pattern.
    """
    if not tool_name_to_display_name:
        return

    for original_name, display_name in tool_name_to_display_name.items():
        if display_name and not TOOL_DISPLAY_NAME_PATTERN.match(display_name):
            from fastapi import HTTPException
            from starlette import status

            raise HTTPException(
                status_code=status.HTTP_400_BAD_REQUEST,
                detail={
                    "error": (
                        f"Invalid display name '{display_name}' for tool '{original_name}'. "
                        "Display names may only contain letters, digits, underscores, and "
                        "hyphens (no spaces or other special characters), since they replace "
                        "the tool name sent to the LLM provider."
                    )
                },
            )


class MCPMissingUserEnvVarsError(Exception):
    """Raised when an MCP request can't be built because the calling user has
    not supplied one or more required per-user environment variables.

    The error message is user-facing and includes a URL the user can visit
    to fill them in.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use only letters, digits, underscores, and hyphens in the tool display name.

Example fix

display_name='my-tool_v2'
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/_experimental/mcp_server/utils.py:599 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/a487653e70b8ad6f. Report an issue: GitHub.