> ## Documentation Index
> Fetch the complete documentation index at: https://docs.laozhang.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I fix Claude Code AWS Claude 400 ValidationException errors?

> Fix Claude Code 400 ValidationException, Extra inputs are not permitted, and cache_control.scope errors when using the AWS Claude official route through LaoZhang API.

## Short Answer

If Claude Code returns `400 ValidationException`, `Extra inputs are not permitted`, or an error related to `cache_control.scope` on the AWS Claude official route, set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` before starting Claude Code. This disables Claude Code experimental beta request fields so unsupported extra fields are not rejected by the AWS Claude / Bedrock route. Use `export` for a quick test, then put the setting in `~/.claude/settings.json` for persistent use.

## When This Applies

* Claude Code is already configured with LaoZhang API
* The request uses the AWS Claude official route or a Bedrock-related route
* The terminal or request log shows `400 ValidationException`
* The error contains `Extra inputs are not permitted`
* The error points to `cache_control.scope`, `cache_control`, `scope`, or another extra request field
* The API key, balance, and model ID look correct, but Claude Code is rejected before a normal model response

<Info>
  This error is usually a request-field compatibility issue. It does not automatically mean the account balance, model permission, or API key is wrong. Disable experimental beta request fields before rotating keys.
</Info>

## Steps To Fix

<Steps>
  <Step title="Stop the current Claude Code process">
    If Claude Code is already running, exit it first. The environment variable must be present before Claude Code starts.
  </Step>

  <Step title="Export the compatibility setting">
    Run this in the same terminal where you will start Claude Code:

    ```bash theme={null}
    export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
    ```
  </Step>

  <Step title="Start Claude Code again">
    Start Claude Code from the same terminal:

    ```bash theme={null}
    claude
    ```

    If the 400 error disappears, the issue was likely caused by Claude Code experimental beta fields being rejected by the AWS Claude / Bedrock route.
  </Step>
</Steps>

## Persistent settings.json Configuration

To avoid setting the variable every time, add it to `~/.claude/settings.json`:

```json theme={null}
{
  "env": {
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
```

If `~/.claude/settings.json` already contains your LaoZhang API base URL, token, and model, merge the new key into the existing `env` object instead of replacing the file:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api2.laozhang.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-laozhang-api-key",
    "ANTHROPIC_MODEL": "claude-sonnet-4-6",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}
```

<Warning>
  Do not share screenshots that expose the full `ANTHROPIC_AUTH_TOKEN`, API key, or AccessToken. If support needs the configuration, send a masked version plus the full error text.
</Warning>

## Why This Fix Works

Some Claude Code versions may add experimental beta fields to the request body. The AWS Claude official route or Bedrock-related route may strictly validate the payload and reject unsupported fields with errors such as:

* `400 ValidationException`
* `Extra inputs are not permitted`
* Errors related to `cache_control.scope`

`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` tells Claude Code not to send those experimental beta request fields, making the request shape closer to what the route accepts. This setting fixes field compatibility only; it does not replace checks for model access, balance, API key validity, or model ID correctness.

## If The Error Continues

1. Restart the terminal or restart Claude Code after changing the setting.
2. Check that `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is under the top-level `env` object in `~/.claude/settings.json`.
3. Update Claude Code to the current available version and retry.
4. Confirm that the model ID is still available in the console.
5. Make sure you are using a LaoZhang API key and a token group that works with Claude Code.
6. Check [usage logs](/en/faq/call-logs) to see whether the failure is request validation, model access, or balance related.

## Still Need Help

If disabling experimental beta fields does not fix the issue, send support:

* Account email or username
* Claude Code version
* Operating system and terminal type
* Model ID
* Whether the AWS Claude official route is being used
* Full error text, especially the field name after `ValidationException`
* Request time, status, and Request ID from LaoZhang API [usage logs](/en/faq/call-logs)
* A masked `~/.claude/settings.json`, without the full API key or AccessToken

## Related

* For the full setup guide, see [Claude Code Setup Guide](/en/scenarios/programming/claude-code)
* To check model access, see [Model Availability and Permissions](/en/faq/model-availability)
* To create or rotate an API key, see [Token Management](/en/faq/token-management)
* To inspect request status, see [How do I view my usage logs?](/en/faq/call-logs)
