BerriAI/litellm · error · ValueError

sqs_app_encryption_key_b64 is required when encryption is…

Error message

sqs_app_encryption_key_b64 is required when encryption is enabled.

What it means

SQS logger init enabled application-level encryption (sqs_aws_use_application_level_encryption) but no base64 key was supplied via sqs_app_encryption_key_b64 or litellm.aws_sqs_callback_params, so messages cannot be encrypted before enqueueing.

Solutions

  1. Provide sqs_app_encryption_key_b64 (base64-encoded encryption key) when SQS encryption is enabled.

Example fix

export SQS_APP_ENCRYPTION_KEY_B64=$(openssl rand -base64 32)
Defensive patterns

Strategy: validation

When it happens

Trigger: SQS logging started with encryption enabled but no key configured.

Common situations: Encryption flag turned on without provisioning the key material.


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

Appendix: source

Thrown at litellm/integrations/sqs.py:197

            litellm.aws_sqs_callback_params.get("sqs_strip_base64_files", False) or sqs_strip_base64_files
        )

        self.sqs_aws_use_application_level_encryption = (
            litellm.aws_sqs_callback_params.get("sqs_aws_use_application_level_encryption", False)
            or sqs_aws_use_application_level_encryption
        )
        self.sqs_app_encryption_key_b64 = (
            litellm.aws_sqs_callback_params.get("sqs_app_encryption_key_b64") or sqs_app_encryption_key_b64
        )
        self.sqs_app_encryption_aad = (
            litellm.aws_sqs_callback_params.get("sqs_app_encryption_aad") or sqs_app_encryption_aad
        )
        self.app_crypto: AppCrypto | None = None
        if self.sqs_aws_use_application_level_encryption:
            from litellm.litellm_core_utils.app_crypto import AppCrypto

            if not self.sqs_app_encryption_key_b64:
                raise ValueError("sqs_app_encryption_key_b64 is required when encryption is enabled.")
            key = base64.b64decode(self.sqs_app_encryption_key_b64)
            self.app_crypto = AppCrypto(key)
            verbose_logger.debug("SQSLogger: Application-level encryption enabled.")
        self.sqs_config = litellm.aws_sqs_callback_params.get("sqs_config") or sqs_config

    async def async_log_success_event(self, kwargs, response_obj, start_time, end_time) -> None:
        try:
            verbose_logger.debug("SQS Logging - Enters logging function for model %s", kwargs)
            standard_logging_payload = kwargs.get("standard_logging_object")
            if self.sqs_strip_base64_files:
                standard_logging_payload = await self._strip_base64_from_messages(standard_logging_payload)
            if standard_logging_payload is None:
                raise ValueError("standard_logging_payload is None")

            self.log_queue.append(standard_logging_payload)
            verbose_logger.debug(
                "sqs logging: queue length %s, batch size %s",
                len(self.log_queue),

View on GitHub (pinned to 77b7c6c40c)