{"record":{"id":"29311865f6f3d30b","repo":"BerriAI/litellm","slug":"no-guardrail-translation-mapping-found-for-call-ty","errorCode":null,"errorMessage":"No guardrail translation mapping found for call_type: {call_type}. Available mappings: {list(endpoint_guardrail_translation_mappings.keys())}","messagePattern":"No guardrail translation mapping found for call_type: (.+?)\\. Available mappings: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/__init__.py","lineNumber":178,"sourceCode":"\n    Args:\n        call_type: The type of call (e.g., completion, acompletion, anthropic_messages)\n\n    Returns:\n        The translation handler class for the given call type\n\n    Raises:\n        ValueError: If no translation mapping exists for the given call type\n    \"\"\"\n    global endpoint_guardrail_translation_mappings\n\n    # Lazy load the mappings on first access\n    if endpoint_guardrail_translation_mappings is None:\n        endpoint_guardrail_translation_mappings = discover_guardrail_translation_mappings()\n\n    # Get the translation handler class for the call type\n    if call_type not in endpoint_guardrail_translation_mappings:\n        raise ValueError(\n            f\"No guardrail translation mapping found for call_type: {call_type}. \"\n            f\"Available mappings: {list(endpoint_guardrail_translation_mappings.keys())}\"\n        )\n\n    # Return the handler class directly\n    return endpoint_guardrail_translation_mappings[call_type]\n","sourceCodeStart":160,"sourceCodeEnd":185,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/__init__.py#L160-L185","documentation":"Raised by get_guardrail_translation_mapping when the requested call_type has no registered guardrail translation handler. Mappings are lazily discovered via discover_guardrail_translation_mappings(), which collects handlers (including MCP guardrail translation mappings from litellm.proxy._experimental.mcp_server.guardrail_translation) keyed by CallTypes. Requesting a call type outside the discovered set — or when discovery silently failed — raises this ValueError, and the message lists the valid keys so you can self-correct.","triggerScenarios":"Calling get_guardrail_translation_mapping(call_type) with a CallTypes enum member that has no registered translation handler — e.g. a rarely-used call type (embeddings, rerank, transcription) when only completion/anthropic-style handlers installed; or when discovery hit an exception (logged as 'Error discovering guardrail translation mappings') leaving an empty/partial mapping cache.","commonSituations":"Extending the MCP guardrail server to a new endpoint whose call type lacks a handler; version drift between litellm core CallTypes enum and the proxy experimental MCP package (new call types added before handlers); an ImportError inside discovery silently shrinking the mapping set; typos/renames of CallTypes values across versions.","solutions":["Read the message: it lists the available call types — switch your call to one of those.","If you need the unsupported call type, implement and register a BaseTranslation handler for it in the guardrail translation mappings dict.","Check litellm logs for 'Error discovering guardrail translation mappings' — a failed import (e.g. missing optional deps) may have emptied the mappings; fix the import error and restart.","Upgrade/downgrade litellm so the CallTypes enum and translation handlers are from the same release."],"exampleFix":"# before\nhandler = get_guardrail_translation_mapping(CallTypes.RERANK)  # not registered\n\n# after (register a handler, or use a supported call type)\nfrom litellm.proxy._experimental.mcp_server.guardrail_translation import guardrail_translation_mappings\n\nclass RerankGuardrailTranslation(BaseTranslation):\n    ...\n\nguardrail_translation_mappings[CallTypes.RERANK] = RerankGuardrailTranslation\nhandler = get_guardrail_translation_mapping(CallTypes.RERANK)","handlingStrategy":"validation","validationCode":"from litellm.llms import load_guardrail_translation_mappings\n\ndef supports_guardrail_translation(call_type) -> bool:\n    return call_type in load_guardrail_translation_mappings()","typeGuard":"from litellm.llms import load_guardrail_translation_mappings\n\ndef is_supported_call_type(call_type) -> bool:\n    try:\n        return call_type in load_guardrail_translation_mappings()\n    except Exception:\n        return False","tryCatchPattern":"try:\n    handler = get_guardrail_translation_mapping(call_type)\nexcept ValueError as e:\n    raise HTTPException(400, f\"unsupported call type: {e}\")","preventionTips":["Check membership in load_guardrail_translation_mappings() before requesting a handler.","Watch startup logs for 'Error discovering guardrail translation mappings' — silent ImportError shrinks the registry.","Keep CallTypes usage and translation handler registration in the same litellm version; no cross-version mixing."],"tags":["guardrails","mcp","call-type","registry","valueerror"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}