{"record":{"id":"25bd347c4cf5dc90","repo":"PaddlePaddle/PaddleOCR","slug":"unsupported-model-normalized-r-supported-model","errorCode":null,"errorMessage":"Unsupported model: {normalized!r}. Supported models: {supported}.","messagePattern":"Unsupported model: (.+?)\\. Supported models: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mcp_server/paddleocr_mcp/selection.py","lineNumber":63,"sourceCode":"    \"PP-StructureV3\": \"pp_structurev3\",\n    \"PaddleOCR-VL\": \"paddleocr_vl\",\n    \"PaddleOCR-VL-1.5\": \"paddleocr_vl\",\n    \"PaddleOCR-VL-1.6\": \"paddleocr_vl\",\n}\n\n\ndef tool_for_model(model: str) -> str:\n    \"\"\"Return the MCP tool name for a validated model.\"\"\"\n    return _MODEL_TOOLS[model]\n\n\ndef resolve_model(model: Optional[str], provider: str) -> str:\n    \"\"\"Validate and normalize the user-facing model name.\"\"\"\n    normalized = (model or DEFAULT_MODEL).strip()\n    normalized_provider = normalize_provider(provider)\n    if normalized not in SUPPORTED_MODELS:\n        supported = \", \".join(sorted(SUPPORTED_MODELS))\n        raise ValueError(\n            f\"Unsupported model: {normalized!r}. Supported models: {supported}.\"\n        )\n\n    if (\n        normalized_provider is InferenceProvider.QIANFAN\n        and normalized not in QIANFAN_SUPPORTED_MODELS\n    ):\n        supported = \", \".join(sorted(QIANFAN_SUPPORTED_MODELS))\n        raise ValueError(\n            f\"Model {normalized!r} is not supported with qianfan source. \"\n            f\"Supported models: {supported}.\"\n        )\n\n    return normalized\n","sourceCodeStart":45,"sourceCodeEnd":78,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/mcp_server/paddleocr_mcp/selection.py#L45-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Copy a name verbatim from the error's supported list (it is printed, sorted).","Omit --model to use DEFAULT_MODEL.","Upgrade the paddleocr-mcp package if the model was added in a newer registry.","Match casing exactly — resolve_model strips whitespace but does not lower()/upper()."],"exampleFix":"// before\npaddleocr-mcp --model ppocrv5\nValueError: Unsupported model: 'ppocrv5'. Supported models: ...\n\n// after\npaddleocr-mcp --model PP-OCRv5   # exact name from the supported list","handlingStrategy":"validation","validationCode":"from paddleocr_mcp.selection import SUPPORTED_MODELS\n\ndef model_supported(model: str | None) -> bool:\n    return (model or \"\").strip() in SUPPORTED_MODELS","typeGuard":"from typing import Any\n\ndef is_supported_model(value: Any) -> bool:\n    return isinstance(value, str) and value.strip() in SUPPORTED_MODELS","tryCatchPattern":"try:\n    resolve_model(model, provider)\nexcept ValueError as e:\n    if \"Unsupported model\" in str(e):\n        log.error(\"pick from: %s\", \", \".join(sorted(SUPPORTED_MODELS)))\n    raise","preventionTips":["Populate model dropdowns/configs from SUPPORTED_MODELS at runtime rather than hardcoded lists.","Match model-name casing exactly; normalization strips whitespace only.","Re-validate model names after upgrading the MCP server package."],"tags":["python","mcp","model-selection","validation"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}