GitHub Copilot GPT-5 throwing "invalid_request_body" on requests after compaction #7613

Open
opened 2026-02-16 18:07:43 -05:00 by yindo · 6 comments
Owner

Originally created by @LiamMacP on GitHub (Jan 26, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When running OpenCode alongside GitHub Copilot GTP-5, whenever the context window gets to compaction the TUI throws "{"error":{"message":"","code":"invalid_request_body"}}". This then no longer allows any GPT-5 prompt as the next.

This is running in a Dockerised environment (ubuntu:24.04) with the following tooling:

  • git curl ca-certificates gnupg jq tar unzip ripgrep fd-find locales openssh-client tini

Workaround:

  • I sometimes change (see second attachment of this not working; could be the moving from Build to Plan?). to another model gpt-5-mini, get it to run the next command (although this then means I don't get great results, and then changing back after. Undo and Redo, haven't appeared to help here.

Notes:

  • I have previously seen this behaviour by initialising a blank session and requesting basic functionality such as "What is the current time?". This does appear to have resolved for the moment, but wanted to note it.

Plugins

None

OpenCode version

1.1.34 (but have seen across earlier versions)

Steps to reproduce

  1. On GitHub Copilot - use the model GPT 5
  2. Fill the context until compaction
  3. Send a request.

Screenshot and/or share link

Image Image

Operating System

Dockerised (Ubuntu 24.04)

Terminal

Ghostty (container TERM is set to xterm-256color)

Originally created by @LiamMacP on GitHub (Jan 26, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description When running OpenCode alongside GitHub Copilot GTP-5, whenever the context window gets to compaction the TUI throws "{"error":{"message":"","code":"invalid_request_body"}}". This then no longer allows any GPT-5 prompt as the next. This is running in a Dockerised environment (ubuntu:24.04) with the following tooling: - git curl ca-certificates gnupg jq tar unzip ripgrep fd-find locales openssh-client tini Workaround: - I sometimes change (see second attachment of this not working; could be the moving from Build to Plan?). to another model gpt-5-mini, get it to run the next command (although this then means I don't get great results, and then changing back after. Undo and Redo, haven't appeared to help here. Notes: - I have previously seen this behaviour by initialising a blank session and requesting basic functionality such as "What is the current time?". This does appear to have resolved for the moment, but wanted to note it. ### Plugins None ### OpenCode version 1.1.34 (but have seen across earlier versions) ### Steps to reproduce 1. On GitHub Copilot - use the model GPT 5 2. Fill the context until compaction 3. Send a request. ### Screenshot and/or share link <img width="1923" height="192" alt="Image" src="https://github.com/user-attachments/assets/672a6313-8fd9-47c7-af88-35f9435608af" /> <img width="1921" height="271" alt="Image" src="https://github.com/user-attachments/assets/c538b2a7-a45c-4e1c-8978-306a1ec5f82a" /> ### Operating System Dockerised (Ubuntu 24.04) ### Terminal Ghostty (container TERM is set to xterm-256color)
yindo added the bug label 2026-02-16 18:07:43 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 26, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10634: Compaction overflow check doesn't account for large tool outputs until the next step, causing context overflow
  • #10496: The /compact command does not work
  • #10385: Compaction bug - prompt token limit

These issues relate to context compaction and token limit handling. While your issue specifically involves the GitHub Copilot GPT-5 provider returning an invalid_request_body error after compaction, it may be connected to underlying compaction logic issues.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 26, 2026): This issue might be a duplicate of existing issues. Please check: - #10634: Compaction overflow check doesn't account for large tool outputs until the next step, causing context overflow - #10496: The /compact command does not work - #10385: Compaction bug - prompt token limit These issues relate to context compaction and token limit handling. While your issue specifically involves the GitHub Copilot GPT-5 provider returning an `invalid_request_body` error after compaction, it may be connected to underlying compaction logic issues. Feel free to ignore if none of these address your specific case.
Author
Owner

@LiamMacP commented on GitHub (Jan 26, 2026):

Another instance attached:
Image

@LiamMacP commented on GitHub (Jan 26, 2026): Another instance attached: <img width="905" height="266" alt="Image" src="https://github.com/user-attachments/assets/fdf18b43-016b-464c-a023-2648ab9a608b" />
Author
Owner

@LiamMacP commented on GitHub (Jan 27, 2026):

Reproduced on fresh session, Plan mode, default gpt-5 settings:
Image

@LiamMacP commented on GitHub (Jan 27, 2026): Reproduced on fresh session, Plan mode, default gpt-5 settings: <img width="1688" height="314" alt="Image" src="https://github.com/user-attachments/assets/f276af4f-5258-4266-87c3-0688313352c8" />
Author
Owner

@adiled commented on GitHub (Jan 28, 2026):

Reproduced in plan mode of an opus-maintained session, after switching to codex (since anthropic got the itch again).

Env: OSX 26.1 / Opencode 1.1.37

Image
@adiled commented on GitHub (Jan 28, 2026): Reproduced in plan mode of an opus-maintained session, after switching to codex (since anthropic got the itch again). Env: OSX 26.1 / Opencode 1.1.37 <img width="439" height="105" alt="Image" src="https://github.com/user-attachments/assets/e0f25838-3b3c-4795-b90a-5d8ccdd9108c" />
Author
Owner

@adiled commented on GitHub (Jan 28, 2026):

Reproduced on a fresh session, in a fresh terminal window.

Image
@adiled commented on GitHub (Jan 28, 2026): Reproduced on a fresh session, in a fresh terminal window. <img width="846" height="249" alt="Image" src="https://github.com/user-attachments/assets/ed3069cd-41cd-4b4d-a0fe-5f444978d826" />
Author
Owner

@LiamMacP commented on GitHub (Jan 28, 2026):

Appeared to have worked past compaction on 1.1.39 🚀 :
Image

Still failed on a new request:
Image

@LiamMacP commented on GitHub (Jan 28, 2026): Appeared to have worked past compaction on 1.1.39 🚀 : <img width="1069" height="193" alt="Image" src="https://github.com/user-attachments/assets/48a95fb3-c0fa-4bfc-8de7-2e76b292e8f1" /> Still failed on a new request: <img width="1686" height="555" alt="Image" src="https://github.com/user-attachments/assets/569420b1-a445-4eca-b5dc-1f12a96810dd" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7613