BerriAI/litellm · error · ValueError

BedrockGuardrail: 'checks' block contained only…

Error message

BedrockGuardrail: 'checks' block contained only unrecognized or empty keys {sorted(raw.keys())}. Known keys: {sorted(_BEDROCK_CHECKS_KNOWN_KEYS)}. Fix the guardrail config or remove the 'checks' block to use ApplyGuardrail mode.

What it means

Error "BedrockGuardrail: 'checks' block contained only unrecognized or empty keys {sorted(raw.keys())}. Known keys: {sorted(_BEDROCK_CHECKS_KNOWN_KEYS)}. Fix the guardrail config or remove the 'checks' block to use ApplyGuardrail mode." thrown in BerriAI/litellm.

Solutions

  1. Fix the checks block to use the known check keys listed in the error, or remove the checks block.

Example fix

checks:
  content_filters: [...]  # use only keys from _BEDROCK_CHECKS_KNOWN_KEYS
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py:311 when the library encounters an invalid state.

Common situations: The Bedrock checks block contains only unrecognized or empty keys.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/acf327ad66b7aed2. Report an issue: GitHub.

Appendix: source

Thrown at litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py:311

        Accepts a pydantic ``BedrockChecksConfigModel`` or a raw dict; drops None /
        unknown keys. Returns None when no usable check is configured (=> ApplyGuardrail).
        """
        if checks is None:
            return None
        raw = checks.model_dump(exclude_none=True) if isinstance(checks, BedrockChecksConfigModel) else dict(checks)
        unknown_keys: Final = set(raw.keys()) - _BEDROCK_CHECKS_KNOWN_KEYS
        if unknown_keys:
            verbose_proxy_logger.warning(
                "BedrockGuardrail: unrecognized check key(s) %s will be ignored; "
                "recognized keys will still be used for InvokeGuardrailChecks. "
                "Known keys: %s.",
                sorted(unknown_keys),
                sorted(_BEDROCK_CHECKS_KNOWN_KEYS),
            )
        cleaned = {key: value for key, value in raw.items() if key in _BEDROCK_CHECKS_KNOWN_KEYS and value is not None}
        if not cleaned and raw:
            raise ValueError(
                f"BedrockGuardrail: 'checks' block contained only unrecognized or empty keys {sorted(raw.keys())}. "
                f"Known keys: {sorted(_BEDROCK_CHECKS_KNOWN_KEYS)}. "
                "Fix the guardrail config or remove the 'checks' block to use ApplyGuardrail mode."
            )
        return cleaned or None

    def _create_bedrock_input_content_request(self, messages: list[AllMessageValues] | None) -> BedrockRequest:
        """
        Create a bedrock request for the input content - the LLM request.
        """
        bedrock_request: Final[BedrockRequest] = BedrockRequest(source="INPUT")
        bedrock_request_content: Final[list[BedrockContentItem]] = []
        if messages is None:
            return bedrock_request
        for message in messages:
            blocks = self.get_content_items_for_message(message=message)
            if blocks is None:
                continue

View on GitHub (pinned to 77b7c6c40c)