Repository navigation
Copilot Claude Opus 4.8 assistant prefill 400 after malformed pseudo tool-call text #31807
Description
Description
github-copilot/claude-opus-4.8 can reject a follow-up request with:
APIError 400: This model does not support assistant message prefill.
The conversation must end with a user message.
isRetryable: false
After re-checking local SQLite metadata on OpenCode 1.17.7, this now appears to be downstream of the malformed pseudo tool-call issue in #31247.
The observed chain is:
- Opus 4.8 emits pseudo tool-call text such as
<invoke ...>as assistant text. - The assistant message is still marked
finish=tool-calls. - There is no structured tool part in that assistant message.
- OpenCode continues the tool loop.
- The next provider request effectively ends with an assistant message.
- Copilot Claude rejects that request as unsupported assistant prefill.
Steps to Reproduce
I do not yet have a small deterministic repro, but the failures occurred in normal OpenCode TUI sessions using github-copilot/claude-opus-4.8:
- Start an OpenCode TUI session with
github-copilot/claude-opus-4.8. - Perform a long tool-heavy task.
- Continue through multiple automatic tool-call turns.
- Hit a malformed Opus 4.8 turn where
finish=tool-calls, there are zero structured tool parts, and the assistant text contains pseudo tool-call markup such as<invoke ...>. - Observe the next request fail with the assistant-prefill 400.
Expected Behavior
OpenCode should not send a Copilot Claude request whose final message is assistant.
More importantly, OpenCode should handle a malformed finish=tool-calls response with no actual tool call at the root, instead of continuing the tool loop with an assistant-ending history.
Actual Behavior
The provider rejects the follow-up request with:
This model does not support assistant message prefill.
The conversation must end with a user message.
Every sampled prefill 400 was immediately preceded by a claude-opus-4.8 assistant message with this structure:
finish: tool-calls
structured tool parts: 0
assistant text contains: <invoke ...>
Sampled chain:
| Error message | Previous message | Previous finish | Previous tool parts | Previous text contains <invoke> |
|---|---|---|---|---|
msg_ea14109c... |
msg_ea140d8ac... |
tool-calls |
0 | yes |
msg_ea14ee3d... |
msg_ea14ec5d... |
tool-calls |
0 | yes |
msg_ea1565f9... |
msg_ea1562db... |
tool-calls |
0 | yes |
Additional Evidence
Downstream symptom evidence:
https://gist.github.com/doomsday616/659c12bc0d0f02dff5a605e2ea6ec4cd
Root-cause evidence is in #31247:
https://gist.github.com/doomsday616/d3fb56acd0f14964a9797df35f1fcd96
Both gists contain only sanitized structural metadata from local SQLite rows. Private message text and local/private identifiers are not included.
OpenCode Version
1.17.7
Operating System
Windows 11
Terminal
Windows Terminal / PowerShell 7
Provider / Model
github-copilot / claude-opus-4.8
Related Issues
- Copilot Claude Opus 4.8 emits pseudo tool-call text instead of structured tool calls #31247 — likely root cause: Opus 4.8 pseudo tool-call text persisted as assistant text while
finish=tool-callsand no structured tool part exists. - This model does not support assistant message prefill / Github Copilot with Opus 4.6 #13768 — same/similar assistant-prefill rejection with GitHub Copilot + Claude Opus.
- Azure AI Claude rejects requests after tool abort: assistant message prefill not supported #19517 — Azure AI Claude via LiteLLM rejects assistant prefill.
- Bedrock Claude Opus 4.6 rejects assistant message prefill #29760 — Bedrock Claude Opus 4.6 rejects assistant prefill.
Sanitization
The original full session contains private content, so I cannot share a raw export publicly. The linked evidence includes only sanitized structural excerpts and provider error metadata.
Activity
[-]GitHub Copilot Claude rejects assistant prefill after interrupted/partial turns[/-][+]GitHub Copilot Claude Opus 4.8 rejects assistant prefill after interrupted/partial turns[/+][-]GitHub Copilot Claude Opus 4.8 rejects assistant prefill after interrupted/partial turns[/-][+]Copilot Claude Opus 4.8 assistant prefill 400 after malformed pseudo tool-call text[/+]lazyalex616 commentedon Jun 16, 2026
@kitlangton @rekram1-node @simonklee @malventano @marcusquinn I updated this issue after re-checking local SQLite metadata on OpenCode 1.17.7.
This now appears to be downstream of #31247 rather than an independent assistant-prefill-only bug.
Every sampled prefill 400 was immediately preceded by a
github-copilot/claude-opus-4.8assistant message with:finish = tool-calls<invoke ...>The follow-up request then effectively ends with assistant and Copilot rejects it with:
Updated symptom evidence:
https://gist.github.com/doomsday616/659c12bc0d0f02dff5a605e2ea6ec4cd
Root-cause evidence is in #31247:
https://gist.github.com/doomsday616/d3fb56acd0f14964a9797df35f1fcd96
I withdrew the earlier workaround PR so we can target the malformed tool-call handling directly.
lazyalex616 commentedon Jun 21, 2026
@thdxr @rekram1-node @kitlangton @simonklee @malventano @marcusquinn @wgu9 @jquense @Nomadcxx @keefetang
Small update after checking the v1.17.9 release: this still does not appear to be fixed in v1.17.9.
This Opus 4.8 assistant-prefill 400 has been confirmed in v1.17.7 and remains unresolved through v1.17.9. It is very disruptive because once the malformed assistant/tool-call turn happens, the next request can fail with
This model does not support assistant message prefill, interrupting normal multi-step work.Please, could someone help triage whether fixing #31247 is enough, or whether OpenCode also needs a defensive guard against assistant-ending Copilot Claude requests? 🙏
。゚(゚´ω`゚)゚。 please have mercy and take a look, we are begging on our paws 🐾
github-actions commentedon Aug 21, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.