From 88639d221f958cfb939423e9e89803b1c5a85e3a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 25 May 2026 12:30:37 +0000 Subject: [PATCH] fix(bedrock): pop None context_management before sending to Bedrock Converse If context_management is forwarded as None (e.g. when mapping returns None for an invalid format), _filter_context_management_for_bedrock_converse previously returned early without removing the key, leaving "context_management": null in the request and causing a validation error. Pop the key when the value is not a dict. Co-authored-by: Yassin Kortam --- litellm/llms/bedrock/chat/converse_transformation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index 7d43e13ff0b..d2e12b7065b 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -1460,6 +1460,7 @@ class AmazonConverseConfig(BaseConfig): """Keep only compact_20260112 edits for Bedrock; add beta header or drop field.""" cm = additional_request_params.get("context_management") if not isinstance(cm, dict): + additional_request_params.pop("context_management", None) return edits = cm.get("edits") if not isinstance(edits, list):