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

2026年03月26日 10:08 状态: processing

🚨 错误信息

"InvokeModel: operation error Bedrock Runtime: InvokeModel, https response error StatusCode: 400, RequestID: f417b356-3d95-42da-ade6-745dbd0b80b4, ValidationException: Malformed input request: #: subject must not be valid against schema {\"required\":[\"messages\"]}#: extraneous key [output_config] is not permitted#/thinking/type: adaptive is not a valid enum value, please reformat your input and try again. (request id: 20260326100632144778559pmZSS9OY)"

🤖 AI解决方案

报错分析报告

1.错误翻译



原文:Malformed input request: #: subject must not be valid against schema {"required":["messages"]}#: extraneous key [output_config] is not permitted#/thinking/type: adaptive is not a valid enum value, please reformat your input and try again.
译文:请求格式错误:主体不符合要求必须包含["messages"]字段的 schema 验证;存在不允许的额外键[output_config];/thinking/type 的取值 adaptive 不是有效枚举值,请重新格式化输入后重试。

2.原因分析


  • 根本原因:输入请求违反Bedrock Runtime的JSON Schema校验规则。

  • 具体问题

  • 1. 请求中存在不允许的额外键output_config
    2. /thinking/type字段取值adaptive不是有效枚举值
    3. subject部分未满足schema要求的必填字段messages

    3. 解决方案


    json
    // 修复后的请求示例(以JSON为例)
    {
    "subject": {
    "messages": [ // 补充必填的messages数组
    {"role": "user", "content": "你的输入内容"}
    ]
    },
    "thinking": {
    "type": "default" // 替换为有效枚举值(如default,需参考API文档)
    }
    // 移除output_config键
    }

    4.️ 预防措施


  • 预校验输入:用[JSON Schema Validator](https://www.jsonschemavalidator.net/)工具提前验证请求结构;

  • 参考官方文档:调用Bedrock API前,确认[允许的参数](https://docs.aws.amazon.com/bedrock/latest/userguide/api-reference.html)和枚举值范围。
  • ---
    请按上述方案调整输入后重试。