{"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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/__init__.py#L160-L185","documentation":"ValueError raised by get_guardrail_translation_mapping when the requested CallTypes value has no entry in the guardrail translation registry. The registry is discovered lazily by scanning litellm/llms/**/guardrail_translation packages (plus the MCP server mappings), so a call type is missing either because no handler ships for it or because its module failed to import during discovery (errors go to verbose_logger). The message lists the available call types.","triggerScenarios":"Applying a guardrail to an endpoint whose call type has no translation handler (compare against the error's 'Available mappings' list); a partially broken install where a guardrail_translation module raised ImportError and was skipped during discovery.","commonSituations":"Adding guardrails to newly introduced or non-standard endpoints; a broken pip install or vendored litellm tree missing subpackages; proxy upgrades that outpace custom guardrail code.","solutions":["Read the error's 'Available mappings' list and route the guardrail through one of those call types.","Upgrade litellm — handlers for more call types are added over releases.","Enable verbose logging and look for 'Could not import litellm.llms...' from discover_guardrail_translation_mappings; reinstall the package if files are missing.","If needed immediately, add a guardrail_translation module exposing a guardrail_translation_mappings dict that maps your call type to a handler class."],"exampleFix":"# before\nhandler = get_guardrail_translation_mapping(CallTypes.my_new_endpoint)\n# ValueError: No guardrail translation mapping found ...\n\n# after\nfrom litellm.llms import load_guardrail_translation_mappings\nmappings = load_guardrail_translation_mappings()\nhandler = mappings.get(CallTypes.my_new_endpoint) or mappings[CallTypes.acompletion]","handlingStrategy":"validation","validationCode":"from litellm.llms import load_guardrail_translation_mappings\n\nmappings = load_guardrail_translation_mappings()\nif call_type not in mappings:\n    raise ValueError(\n        f\"guardrails unsupported for {call_type}; supported: {sorted(str(k) for k in mappings)}\"\n    )\nhandler = mappings[call_type]","typeGuard":"from litellm.llms import load_guardrail_translation_mappings\n\ndef is_supported_guardrail_call_type(call_type) -> bool:\n    return call_type in load_guardrail_translation_mappings()","tryCatchPattern":"try:\n    handler = get_guardrail_translation_mapping(call_type)\nexcept ValueError as e:\n    logger.error(\"guardrail call type not supported: %s\", e)\n    raise HTTPException(status_code=400, detail=str(e))","preventionTips":["Check membership in load_guardrail_translation_mappings() at startup for every guardrail/call-type pair you configure.","Watch verbose logs for 'Could not import litellm.llms...' during discovery — skipped modules silently shrink the registry.","Pin and test litellm versions; guardrail call-type coverage changes between releases."],"tags":["guardrails","call-types","registry","valueerror"],"backgroundTag":"unsupported-endpoint-type","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}