BerriAI/litellm · error · ValueError

Invalid identifier {identifier!r}: contains disallowed chara

Error message

Invalid identifier {identifier!r}: contains disallowed characters

What it means

Error "Invalid identifier {identifier!r}: contains disallowed characters" thrown in BerriAI/litellm.

Source

Thrown at litellm/integrations/arize/arize_phoenix_client.py:14

"""
Arize Phoenix API client for fetching prompt versions from Arize Phoenix.
"""

import urllib.parse
from typing import Any, Final

from litellm.llms.custom_httpx.http_handler import HTTPHandler


def _sanitize_id(identifier: str) -> str:
    """Reject path traversal characters and URL-encode the identifier."""
    if any(c in identifier for c in ("/", "\\", "#", "?")):
        raise ValueError(f"Invalid identifier {identifier!r}: contains disallowed characters")
    if ".." in identifier:
        raise ValueError(f"Invalid identifier {identifier!r}: path traversal detected")
    return urllib.parse.quote(identifier, safe="")


class ArizePhoenixClient:
    """
    Client for interacting with Arize Phoenix API to fetch prompt versions.

    Supports:
    - Authentication with Bearer tokens
    - Fetching prompt versions
    - Direct API base URL configuration
    """

    def __init__(self, api_key: str | None = None, api_base: str | None = None):
        """
        Initialize the Arize Phoenix client.

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Use an identifier containing only allowed characters (letters, digits, dash, underscore).

When it happens

Trigger: Thrown at litellm/integrations/arize/arize_phoenix_client.py:14 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/b47626248f053f8d. Report an issue: GitHub.