BerriAI/litellm · error · ValueError

Invalid RAGFlow model format: {model}. Expected format: ragf

Error message

Invalid RAGFlow model format: {model}. Expected format: ragflow/chat/{{chat_id}}/{{model}} or ragflow/agent/{{agent_id}}/{{model}}

What it means

Model-format parser guard in the RAGFlow chat config: splitting the model string on '/' yielded fewer than 4 segments, so it cannot be the required ragflow/{chat|agent}/{id}/{model_name} form. The whole model string is echoed back for correction.

Source

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

    - ragflow/agent/{agent_id}/{model_name} for agent endpoints
    """

    def _parse_ragflow_model(self, model: str) -> tuple[str, str, str]:
        """
        Parse RAGFlow model name format: ragflow/{endpoint_type}/{id}/{model_name}

        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,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use model format ragflow/chat/{{chat_id}}/{{model}} or ragflow/agent/{{agent_id}}/{{model}}.
  2. Check for typos or missing segments in the model string.

Example fix

model="ragflow/chat/abc123/qwen-plus"
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when the RAGFlow model string does not match ragflow/chat/<chat_id>/<model> or ragflow/agent/<agent_id>/<model>.

Common situations: See trigger scenarios.


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