claude-code - 💡(How to fix) Fix [BUG] Claude Code sends invalid tool schemas with `required: null` [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49637Fetched 2026-04-17 08:35:32
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Claude Code CLI sends tool schemas where the required field is null instead of an empty array [] when tools have no required fields. This violates JSON Schema specification and causes strict validators (like AI Proxies and OpenAI-compatible endpoints) to reject requests with 400 Bad Request.

Error Message

API Error: 400 tools.67.custom.input_schema.required: Input should be a valid list

Root Cause

Claude Code CLI sends tool schemas where the required field is null instead of an empty array [] when tools have no required fields. This violates JSON Schema specification and causes strict validators (like AI Proxies and OpenAI-compatible endpoints) to reject requests with 400 Bad Request.

Code Example

API Error: 400 tools.67.custom.input_schema.required: Input should be a valid list

---

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": []  // Empty array, not null
        }
      }
    }
  ]
}

---

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": null  // Invalid - should be []
        }
      }
    }
  ]
}

---

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...}
          // "required" field missing entirely
        }
      }
    }
  ]
}

---

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": []  // Empty array, not null
        }
      }
    }
  ]
}

---

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": null  // Invalid - should be []
        }
      }
    }
  ]
}

---

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...}
          // "required" field missing entirely
        }
      }
    }
  ]
}

---

## Error Message

API Error: 400 tools.67.custom.input_schema.required: Input should be a valid list
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Claude Code sends invalid tool schemas with required: null

Summary

Claude Code CLI sends tool schemas where the required field is null instead of an empty array [] when tools have no required fields. This violates JSON Schema specification and causes strict validators (like AI Proxies and OpenAI-compatible endpoints) to reject requests with 400 Bad Request.

Error Message

API Error: 400 tools.67.custom.input_schema.required: Input should be a valid list

Expected Behavior

when a tool has no required fields, Claude Code should send:

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": []  // Empty array, not null
        }
      }
    }
  ]
}

Actual Behavior

Claude Code sends:

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": null  // Invalid - should be []
        }
      }
    }
  ]
}

Or omits the field entirely:

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...}
          // "required" field missing entirely
        }
      }
    }
  ]
}

Impact

  • Breaks proxying through strict JSON Schema validators
  • Incompatible with AI Gateway's
  • Incompatible with OpenAI-compatible API endpoints
  • The Anthropic API itself is lenient and accepts this, but downstream systems don't

Environment

  • Claude CLI: 2.1.112
  • Runtime: Bun 1.3.13
  • Proxy: Kong AI Gateway 3.14.0

Related

Similar issue with tool schema validation affects any strict JSON Schema compliant system downstream of Claude Code CLI.

What Should Happen?

Expected Behavior

when a tool has no required fields, Claude Code should send:

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": []  // Empty array, not null
        }
      }
    }
  ]
}

Actual Behavior

Claude Code sends:

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": null  // Invalid - should be []
        }
      }
    }
  ]
}

Or omits the field entirely:

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...}
          // "required" field missing entirely
        }
      }
    }
  ]
}

Error Messages/Logs

## Error Message

API Error: 400 tools.67.custom.input_schema.required: Input should be a valid list

Steps to Reproduce

Steps to Reproduce

  1. Configure Claude Code CLI to proxy through an AI Gateway (or any JSON Schema validator)
  2. Run a command with Claude Code that uses tools
  3. Claude Code sends a POST request with tools[N].custom.input_schema.required: null
  4. The proxy/validator rejects the request

Claude Model

Other

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.112

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

The most likely fix is to update the Claude Code CLI to send an empty array [] instead of null for the required field in tool schemas when tools have no required fields.

Guidance

  • Verify that the issue is indeed caused by the required field being null or missing by checking the API request payload sent by Claude Code CLI.
  • Update the Claude Code CLI to always include the required field with an empty array [] when tools have no required fields, to ensure compatibility with strict JSON Schema validators.
  • Test the updated CLI with a tool that has no required fields to ensure the required field is sent correctly.
  • If the issue persists, check the proxy/validator configuration to ensure it is correctly handling the updated required field.

Example

{
  "tools": [
    {
      "name": "example",
      "custom": {
        "input_schema": {
          "type": "object",
          "properties": {...},
          "required": []  // Empty array, not null
        }
      }
    }
  ]
}

Notes

The issue may be specific to the Claude Code CLI version 2.1.112 and may not affect other versions. Additionally, the fix may require updates to the CLI's JSON schema generation logic.

Recommendation

Apply a workaround to update the required field to an empty array [] when tools have no required fields, as this is a regression introduced in a previous version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING