CC Switch local proxy failed while handling Codex endpoint /responses. Provider:...

2026年09月29日 10:25 9.93 秒 success

错误信息

CC Switch local proxy failed while handling Codex endpoint /responses. Provider: dmxapi; model: gpt-5.6-luna; upstream_status: HTTP 400; cause: Invalid schema for function 'mcp__codex_app__automation_update': schema must have type 'object' and not have 'oneOf'/'anyOf'/'allOf'/'enum'/'const'/'not' at the top level.

AI 解决方案

原文:CC Switch local proxy failed while handling Codex endpoint /responses. Provider: dmxapi; model: gpt-5.6-luna; upstream_status: HTTP 400; cause: Invalid schema for function 'mcp__codex_app__automation_update': schema must have type 'object' and not have 'oneOf'/'anyOf'/'allOf'/'enum'/'const'/'not' at the top level.
译文:CC Switch 本地代理在处理 Codex 端点 /responses 时失败。提供商:dmxapi;模型:gpt-5.6-luna;上游状态:HTTP 400;原因:函数 'mcp__codex_app__automation_update' 的 schema 无效:schema 必须具有 'object' 类型,且在顶层不能包含 'oneOf'/'anyOf'/'allOf'/'enum'/'const'/'not'。

🎯 原因分析


错误来源是函数 mcp__codex_app__automation_update 的 JSON Schema 定义不符合 API 规范。该 schema 使用了 oneOf、anyOf、allOf、enum、const 或 not 等关键字,而这些在顶层是不被允许的;同时未显式声明顶层类型为 object,导致上游模型返回 HTTP 400。

💡 解决方案

// 错误的 schema 示例(包含 top-level 的 oneOf/anyOf/enum 等)
{
  "oneOf": [
    { "type": "object", "properties": { ... } },
    { "type": "object", "properties": { ... } }
  ]
}

// 修复后的 schema(强制类型为 object,内部结构使用标准 object 关键字)
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": ["active", "inactive"]
    },
    "config": {
      "type": "object",
      "properties": {
        "auto_restart": { "type": "boolean" },
        "threshold": { "type": "number" }
      }
    }
  },
  "required": ["status"]
}

🛡️ 预防措施


  • 使用 JSON Schema 校验工具(如 ajv 或 jsonschema)在开发阶段验证 schema 合法性,确保顶层始终为 type: object

  • 在函数定义中统一采用 properties + required 描述结构,避免顶层使用组合关键字,保持 schema 兼容性