{"record":{"id":"80af02434fffaf86","repo":"BerriAI/litellm","slug":"unable-to-convert-openai-tool-calls-tool-calls-t","errorCode":null,"errorMessage":"Unable to convert openai tool calls={tool_calls} to bedrock tool calls. Received error={e}","messagePattern":"Unable to convert openai tool calls=(.+?) to bedrock tool calls\\. Received error=(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/prompt_templates/factory.py","lineNumber":3715,"sourceCode":"                        # Fallback: no objects extracted — use empty dict.\n                        arguments_dict = {}\n\n                bedrock_tool = BedrockToolUseBlock(input=arguments_dict, name=name, toolUseId=tool_id)\n                bedrock_content_block = BedrockContentBlock(toolUse=bedrock_tool)\n                _parts_list.append(bedrock_content_block)\n\n                # Check for cache_control and add a separate cachePoint block\n                if tool.get(\"cache_control\", None) is not None:\n                    cache_point_block = litellm.AmazonConverseConfig().get_cache_point_block(\n                        {\"cache_control\": tool[\"cache_control\"]},\n                        block_type=\"content_block\",\n                        model=model,\n                    )\n                    if cache_point_block is not None:\n                        _parts_list.append(cache_point_block)\n        return _parts_list\n    except Exception as e:\n        raise Exception(f\"Unable to convert openai tool calls={tool_calls} to bedrock tool calls. Received error={e}\")\n\n\ndef _append_bedrock_tool_result_media_block(\n    tool_result_content_blocks: list[BedrockToolResultContentBlock],\n    processed_block: BedrockContentBlock,\n    content: dict,\n    content_type: str,\n) -> None:\n    if \"image\" in processed_block:\n        tool_result_content_blocks.append(BedrockToolResultContentBlock(image=processed_block[\"image\"]))\n    elif \"document\" in processed_block:\n        tool_result_content_blocks.append(BedrockToolResultContentBlock(document=processed_block[\"document\"]))\n    else:\n        verbose_logger.warning(\n            \"Bedrock Converse: unrecognized BedrockContentBlock keys %s for %s tool-result block %s; dropping.\",\n            list(processed_block.keys()),\n            content_type,\n            content,","sourceCodeStart":3697,"sourceCodeEnd":3733,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/prompt_templates/factory.py#L3697-L3733","documentation":"Converse conversion guard: while translating OpenAI tool_calls to Bedrock Converse toolUse blocks, an exception occurred (e.g. malformed arguments JSON or missing function fields); it is wrapped with the offending tool_calls in the message and re-raised so the caller can see which input failed.","triggerScenarios":"Thrown at litellm/litellm_core_utils/prompt_templates/factory.py:3715 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the tool_calls structure; Bedrock requires specific tool call formats.","Simplify the tool calls or inspect the conversion error {e} for the offending field."],"exampleFix":null,"handlingStrategy":"try-catch","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"}