Skip to content

Claude models (and Gemini Argon) fail with HTTP 400 “request body is not valid JSON”; other models work #5139

Open

Description

@pedromateo

Describe the bug

I consistently encounter errors when using Claude Sonnet 5.5 and Claude Opus 5.5 in GitHub Copilot CLI. Other models appear to work correctly in the same environment. EDIT: also found similar problems with Gemini Argon model

The issue affects me, but colleagues at the same company do not experience it. I have already performed a clean installation of Copilot CLI, and the problem persists. I have also ruled out MCP servers as the cause.

Environment

• GitHub Copilot CLI: 1.0.97
• OS: macOS, ARM64
• Affected models: Claude Sonnet 5.5 and Claude Opus 5.5
• Provider: GitHub Copilot

Steps to reproduce

  1. Start a Copilot CLI session.
  2. Select Claude Sonnet 5.5 or Claude Opus 5.5.
  3. Send a prompt. Even a simple greeting such as “hola” failed with Opus.
  4. The request fails before any assistant response or tool execution.
  5. Switch to a non-Claude model; the session works.

Expected behavior

Claude models should respond normally, as they do for my colleagues.

Actual behavior

Requests to  /v1/messages  fail with HTTP 400 and JSON parsing errors.

For Claude Sonnet 5.5, the logs first show two HTTP 408 request-body upload timeouts for a 161,769-byte request. The CLI retries with a fresh connection, then reports:

Execution failed: 400 The request body is not valid JSON:
request body is not valid JSON: decoding JSON body:
invalid character 'p' after object key

For Claude Opus 5.5, the request fails almost immediately:

Execution failed: 400 The request body is not valid JSON:
request body is not valid JSON: decoding JSON body:
invalid character ':' after object key:value pair

Request IDs — October 14, 2026

• Sonnet, 11:04:06 UTC:  75B5:2DFF7A:51E12:5E166:6ACF61A5 
• Opus, 11:04:31 UTC:  6C22:3A95C8:560F6:62F7D:6ACF61BF 

Since this persists after a clean installation, affects both Claude models, and does not affect other models or my colleagues, could you investigate whether there is an account-specific or request-routing issue in the Claude integration? The available logs do not establish whether the invalid JSON originates in the CLI or in the service handling the request.

Affected version

GitHub Copilot CLI 1.0.97

Steps to reproduce the behavior

No response

Expected behavior

Claude models work as the others do

Additional context

No response

Activity

  1. added theissue type on Oct 14, 2026
  2. changed the title [-]Claude models fail with HTTP 400 “request body is not valid JSON”; other models work[/-] [+]Claude models (and Gemini Argon) fail with HTTP 400 “request body is not valid JSON”; other models work[/+] on Oct 14, 2026
  3. FloRul commented on Oct 15, 2026

    @FloRul

    Experiencing similar issue with all claude models :
    I’m seeing a GitHub Copilot CLI issue that appears specific to Claude models through the interactive CLI path.

    Environment

    • macOS
    • GitHub Copilot CLI  1.0.98 
    • Also tested cached older CLI versions, especially  1.0.94 
    • Models affected:
    •  claude-sonnet-5.5 
    •  claude-haiku-4.5 
    • GPT models work normally in interactive mode.
    • Direct Copilot API calls to Claude models work.

    Primary symptom

    When using Claude models in Copilot CLI interactive mode, requests often fail with HTTP 400 malformed JSON errors from the Anthropic  /v1/messages  path.

    Examples:

    Execution failed: 400 The request body is not valid JSON:
    decoding JSON body: invalid character 't' after object key:value pair

    Other observed variants:

    invalid escape sequence \e in string
    invalid escape sequence \c in string
    invalid character 's' after object key:value pair
    invalid character '}' after object key
    invalid character ':' after object key:value pair
    invalid character 'a' after object key:value pair

    Second symptom

    After reducing the tool surface, the malformed JSON errors mostly stopped, but Claude interactive sessions began hanging and eventually logging upload timeouts:

    Model provider request failed {"api_endpoint":"/v1/messages","http_status":408}
    Request body upload timed out; retrying the identical request
    request_body_bytes=17033 / 19097

    The CLI keeps retrying, so from the user perspective it looks like Claude is “thinking” forever.

    Troubleshooting performed

    1. Verified model access directly
      • Direct Copilot API calls to Claude worked for:
      •  claude-sonnet-5.5 
      •  claude-opus-5.5 
      •  claude-haiku-4.5 
      • This suggests the issue is not entitlement, authentication, or Claude availability.
    2. Checked Copilot CLI versions
      • Current CLI:  1.0.98 
      • Tested cached versions:
      •  1.0.91 
      •  1.0.92 
      •  1.0.93 
      •  1.0.94 
      • Older  1.0.94  sometimes avoided the malformed JSON error, but still hit  /v1/messages  upload timeout in interactive mode.
    3. Disabled likely interactive contributors
      • Disabled MCP servers
      • Disabled local plugins
      • Disabled hooks:
      copilot config disableAllHooks true
      • Disabled IDE auto-connect:
      copilot config ide.autoConnect false
      • Disabled terminal title/progress:
      copilot config updateTerminalTitle false
      copilot config terminalProgress false
    4. Checked Copilot OTel/logs
      • Used Copilot logs / OTel-style traces.
      • Logs consistently point to Anthropic  /v1/messages :
      Model provider request failed {"stage":"inference","api_endpoint":"/v1/messages","http_status":400}
      • Later:
      http_status=408
      Request body upload timed out
    5. Constrained the tool surface
      • Passing  --available-tools bash  reduced the malformed JSON failures:
      copilot --available-tools bash ...
      • Note: adding  "availableTools": ["bash"]  to  ~/.copilot/settings.json  does not work in  1.0.98 ; logs say:
      Ignoring unknown top-level key(s): "availableTools"
      • So the flag must be passed explicitly.
    6. Added a local shell wrapper
      • Wrapped  copilot  in  ~/.zshrc  to inject:
      --available-tools bash
      • This helped with JSON 400 errors but did not fully fix interactive Claude timeouts.
    7. Compared interactive vs prompt mode
      • Claude prompt mode works quickly:
      copilot -p "Reply exactly OK" --model claude-haiku-4.5 --context default --allow-all
      Result:  OK  in ~2 seconds.
      • Claude interactive mode hangs:
      copilot -i hi --model claude-haiku-4.5 --context default --allow-all
      Result:  /v1/messages  upload timeout/retry loop.

    Current conclusion

    This appears to be a Copilot CLI issue in the Claude interactive request path, likely around request construction/serialization and/or upload handling for Anthropic  /v1/messages .

    Evidence:

    • Claude direct Copilot API calls work.
    • Claude  copilot -p  prompt mode works quickly.
    • GPT interactive mode works.
    • Claude  copilot -i  interactive mode either:
    • sends malformed JSON to  /v1/messages , or
    • hangs on request-body upload timeouts.
    • Reducing tools with  --available-tools bash  helps with malformed JSON but not with interactive upload timeout.

    Current workaround

    For Claude:

    copilot -p "your prompt here" --model claude-haiku-4.5 --context default --allow-all

    or:

    copilot -p "your prompt here" --model claude-sonnet-5.5 --context default --allow-all

  4. added
    area:modelsModel selection, availability, switching, rate limits, and model-specific behavior
    and removed on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:modelsModel selection, availability, switching, rate limits, and model-specific behavior

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions