PaddlePaddle/PaddleOCR · error · ValueError

Unsupported model: {normalized!r}. Supported models: {suppor

Error message

Unsupported model: {normalized!r}. Supported models: {supported}.

What it means

ValueError from resolve_model in paddleocr_mcp/selection.py when the (stripped, default-applied) model name is not in the SUPPORTED_MODELS registry. The MCP server validates user-facing model names before mapping them to a tool via _MODEL_TOOLS; unknown names list all supported models in the error.

Source

Thrown at mcp_server/paddleocr_mcp/selection.py:63

    "PP-StructureV3": "pp_structurev3",
    "PaddleOCR-VL": "paddleocr_vl",
    "PaddleOCR-VL-1.5": "paddleocr_vl",
    "PaddleOCR-VL-1.6": "paddleocr_vl",
}


def tool_for_model(model: str) -> str:
    """Return the MCP tool name for a validated model."""
    return _MODEL_TOOLS[model]


def resolve_model(model: Optional[str], provider: str) -> str:
    """Validate and normalize the user-facing model name."""
    normalized = (model or DEFAULT_MODEL).strip()
    normalized_provider = normalize_provider(provider)
    if normalized not in SUPPORTED_MODELS:
        supported = ", ".join(sorted(SUPPORTED_MODELS))
        raise ValueError(
            f"Unsupported model: {normalized!r}. Supported models: {supported}."
        )

    if (
        normalized_provider is InferenceProvider.QIANFAN
        and normalized not in QIANFAN_SUPPORTED_MODELS
    ):
        supported = ", ".join(sorted(QIANFAN_SUPPORTED_MODELS))
        raise ValueError(
            f"Model {normalized!r} is not supported with qianfan source. "
            f"Supported models: {supported}."
        )

    return normalized

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Copy a name verbatim from the error's supported list (it is printed, sorted).
  2. Omit --model to use DEFAULT_MODEL.
  3. Upgrade the paddleocr-mcp package if the model was added in a newer registry.
  4. Match casing exactly — resolve_model strips whitespace but does not lower()/upper().

Example fix

// before
paddleocr-mcp --model ppocrv5
ValueError: Unsupported model: 'ppocrv5'. Supported models: ...

// after
paddleocr-mcp --model PP-OCRv5   # exact name from the supported list
Defensive patterns

Strategy: validation

Validate before calling

from paddleocr_mcp.selection import SUPPORTED_MODELS

def model_supported(model: str | None) -> bool:
    return (model or "").strip() in SUPPORTED_MODELS

Type guard

from typing import Any

def is_supported_model(value: Any) -> bool:
    return isinstance(value, str) and value.strip() in SUPPORTED_MODELS

Try / catch

try:
    resolve_model(model, provider)
except ValueError as e:
    if "Unsupported model" in str(e):
        log.error("pick from: %s", ", ".join(sorted(SUPPORTED_MODELS)))
    raise

Prevention

When it happens

Trigger: Calling the MCP server with --model set to a model not in the registry (e.g. an app-side model id like 'PP-OCRv5_server' when the registry expects normalized names); empty string falling through to DEFAULT_MODEL is fine, but whitespace-stripped mismatches and legacy names fail.

Common situations: Client SDK or config using model identifiers from a different PaddleOCR deployment; MCP server version older than the model the user wants; casing differences (normalization only strips, it does not case-fold).

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/25bd347c4cf5dc90. Report an issue: GitHub.