Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: 4...

2025年12月04日 17:09 状态: processing

🚨 错误信息

InvokeModel: operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: 49622aa2-0723-4837-b377-a52a06f36633, ValidationException: tools.0: Input tag 'tool_search_tool_regex_20251119' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305' (request id: 20251204170548164695755CLP4nhjm) (request id: 20251204170540987603801k129KsXl) (request id: 20251204170540977421531MgTrqD4h) (request id: 20251204170522763594103EqwM16P0)

🤖 AI解决方案

错误分析

1. 错误翻译

原文:ValidationException: tools.0: Input tag 'tool_search_tool_regex_20251119' found using 'type' does not match any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'
译文:验证异常:tools.0:使用'type'找到的输入标签'tool_search_tool_regex_20251119'与任何预期标签都不匹配:'bash_20250124', 'custom', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'web_search_20250305'

2. 原因分析

  • 根本原因:在调用Bedrock模型时,使用了不支持的tool类型 tool_search_tool_regex_20251119
  • 问题位置:tools数组的第一个元素(索引0)的type字段
  • 具体问题:系统只支持特定的工具类型,但传入的工具类型不在允许列表中
  • 3. 解决方案

    {
      "tools": [
        {
          "type": "web_search_20250305",
          // 或者其他支持的tool类型
        }
      ]
    }

    或者移除不支持的tool配置:

    {
      "tools": []
    }

    4. ️ 预防措施

  • 版本检查:在调用API前,确认使用的工具类型在当前Bedrock版本中是否被支持
  • 文档查阅:定期查看AWS Bedrock官方文档,了解可用的工具类型列表和版本变更

---
建议检查您的工具配置,确保使用系统支持的工具类型。