{"record":{"id":"a329a792f6240020","repo":"BerriAI/litellm","slug":"guardrailconfig-raw-guardrail-config-is-missing","errorCode":null,"errorMessage":"guardrailConfig={raw_guardrail_config} is missing 'guardrailIdentifier'. Expected format: {_GUARDRAIL_CONFIG_EXPECTED_FORMAT}","messagePattern":"guardrailConfig=(.+?) is missing 'guardrailIdentifier'\\. Expected format: (.+?)","errorType":"validation","errorClass":"BedrockError","httpStatus":400,"severity":"error","filePath":"litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py","lineNumber":62,"sourceCode":"from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM\n\n_GUARDRAIL_CONFIG_VALIDATOR: Final[\"TypeAdapter[GuardrailConfigBlock]\"] = TypeAdapter(GuardrailConfigBlock)\n\n_GUARDRAIL_CONFIG_EXPECTED_FORMAT: Final = (\n    \"{'guardrailIdentifier': str, 'guardrailVersion': str, 'trace': 'enabled'|'disabled'|'enabled_full'}\"\n)\n\n\ndef _bedrock_invoke_guardrail_headers(raw_guardrail_config: object) -> \"dict[str, str]\":\n    try:\n        guardrail_config: Final = _GUARDRAIL_CONFIG_VALIDATOR.validate_python(raw_guardrail_config)\n    except ValidationError as e:\n        raise BedrockError(\n            status_code=400,\n            message=f\"Invalid guardrailConfig={raw_guardrail_config}. Expected format: {_GUARDRAIL_CONFIG_EXPECTED_FORMAT}. Error: {e}\",\n        )\n    if \"guardrailIdentifier\" not in guardrail_config:\n        raise BedrockError(\n            status_code=400,\n            message=f\"guardrailConfig={raw_guardrail_config} is missing 'guardrailIdentifier'. Expected format: {_GUARDRAIL_CONFIG_EXPECTED_FORMAT}\",\n        )\n    trace: Final = guardrail_config.get(\"trace\")\n    candidate_headers: Final = {\n        \"X-Amzn-Bedrock-GuardrailIdentifier\": guardrail_config.get(\"guardrailIdentifier\"),\n        \"X-Amzn-Bedrock-GuardrailVersion\": guardrail_config.get(\"guardrailVersion\"),\n        \"X-Amzn-Bedrock-Trace\": trace.upper() if trace is not None else None,\n    }\n    return {name: value for name, value in candidate_headers.items() if value is not None}\n\n\nclass AmazonInvokeConfig(BaseConfig, BaseAWSLLM):\n    def __init__(self, **kwargs):\n        BaseConfig.__init__(self, **kwargs)\n        BaseAWSLLM.__init__(self, **kwargs)\n\n    def get_supported_openai_params(self, model: str) -> list[str]:","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py#L44-L80","documentation":"Schema-validation error from the Bedrock guardrail-config TypeAdapter: the user-supplied guardrailConfig passed validation but is missing the required guardrailIdentifier key. The error embeds the raw config and the expected dict shape so the caller can fix the mapping.","triggerScenarios":"Thrown at litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py:62 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add guardrailIdentifier to the guardrailConfig object.","Use the documented format: {'guardrailIdentifier': '...', 'guardrailVersion': '...'}.","Look up the guardrail id in the AWS Bedrock console."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}