BerriAI/litellm · error · ValueError

Invalid RAGFlow model format: {model}. Must start with 'ragf

Error message

Invalid RAGFlow model format: {model}. Must start with 'ragflow/'

What it means

Model-format parser guard in the RAGFlow chat config: the string had enough segments but the first segment is not 'ragflow', so it belongs to a different provider's naming scheme and cannot be routed to the RAGFlow endpoint.

Source

Thrown at litellm/llms/ragflow/chat/transformation.py:52

        Args:
            model: Model name in format ragflow/chat/{chat_id}/{model} or ragflow/agent/{agent_id}/{model}

        Returns:
            Tuple of (endpoint_type, id, model_name)

        Raises:
            ValueError: If model format is invalid
        """
        parts: Final = model.split("/")
        if len(parts) < 4:
            raise ValueError(
                f"Invalid RAGFlow model format: {model}. "
                f"Expected format: ragflow/chat/{{chat_id}}/{{model}} or ragflow/agent/{{agent_id}}/{{model}}"
            )

        if parts[0] != "ragflow":
            raise ValueError(f"Invalid RAGFlow model format: {model}. Must start with 'ragflow/'")

        endpoint_type: Final = parts[1]
        if endpoint_type not in ["chat", "agent"]:
            raise ValueError(f"Invalid RAGFlow endpoint type: {endpoint_type}. Must be 'chat' or 'agent'")

        entity_id: Final = parts[2]
        model_name: Final = "/".join(parts[3:])  # Handle model names that might contain slashes

        return endpoint_type, entity_id, model_name

    def get_complete_url(
        self,
        api_base: str | None,
        api_key: str | None,
        model: str,
        optional_params: dict,
        litellm_params: dict,
        stream: bool | None = None,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Prefix the model string with 'ragflow/'.
  2. Use the full ragflow/chat/<chat_id>/<model> or ragflow/agent/<agent_id>/<model> form.

Example fix

model="ragflow/chat/<chat_id>/<model>"
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when the RAGFlow model string does not start with the 'ragflow/' prefix.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/ae84256b10a1cbb0. Report an issue: GitHub.