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

2026年07月14日 12:49 31.60 秒 success

错误信息

CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: Invalid schema for function 'codex_app__automation_update': schema must be a JSON Schema of 'type: "object"', got 'type: null'.

AI 解决方案

🔍 错误分析

1. 🌐 错误翻译


原文:CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: Invalid schema for function 'codex_app__automation_update': schema must be a JSON Schema of 'type: "object"', got 'type: null'.
译文:CC Switch本地代理在处理Codex端点/responses时失败。提供商:DeepSeek;模型:deepseek-v4-flash;上游状态:HTTP 400;原因:函数'codex_app__automation_update'的schema无效:schema必须是'type: "object"'的JSON Schema,但得到的'type'为null。

2. 🎯 原因分析


  • 根本原因:函数 codex_app__automation_update 的 JSON Schema 验证失败,type 字段的值被设置为 null,但根据规范,该字段必须明确定义为 "object"

  • 错误位置:问题出在调用 DeepSeek 模型时,传递给 /responses 端点的函数定义中,codex_app__automation_update 对应的 schema 缺少有效的 type 声明,导致上游服务返回 HTTP 400 错误。
  • 3. 💡 解决方案


    检查并修复函数 schema 的定义,确保 type 字段明确设置为 "object",且符合 JSON Schema 规范。

    {
      "name": "codex_app__automation_update",
      "description": "Update automation settings",
      "parameters": {
        "type": "object",  // 必须显式声明type为"object"
        "properties": {
          "setting_id": {
            "type": "string",
            "description": "Unique identifier for the automation setting"
          },
          "status": {
            "type": "boolean",
            "description": "Whether the automation is enabled"
          }
        },
        "required": ["setting_id", "status"]
      }
    }
    

    4. 🛡️ 预防措施


  • 严格校验JSON Schema:在定义函数参数时,务必遵循 JSON Schema 规范,确保所有必填字段(如 type)有明确且合法的取值,避免传递 null、未定义或错误类型。

  • 使用Schema校验工具:集成 JSON Schema 校验工具(如 AJV、jsonschema 等)在本地开发和代码提交前进行自动化检查,提前发现格式或字段错误,减少线上问题。