Skip to content

Copilot Claude Opus 4.8 assistant prefill 400 after malformed pseudo tool-call text #31807

Closed as not planned

Description

@lazyalex616

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:

  1. Opus 4.8 emits pseudo tool-call text such as <invoke ...> as assistant text.
  2. The assistant message is still marked finish=tool-calls.
  3. There is no structured tool part in that assistant message.
  4. OpenCode continues the tool loop.
  5. The next provider request effectively ends with an assistant message.
  6. 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:

  1. Start an OpenCode TUI session with github-copilot/claude-opus-4.8.
  2. Perform a long tool-heavy task.
  3. Continue through multiple automatic tool-call turns.
  4. 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 ...>.
  5. 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

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

  1. changed the title [-]GitHub Copilot Claude rejects assistant prefill after interrupted/partial turns[/-] [+]GitHub Copilot Claude Opus 4.8 rejects assistant prefill after interrupted/partial turns[/+] on Jun 11, 2026
  2. changed the title [-]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[/+] on Jun 16, 2026
  3. lazyalex616 commented on Jun 16, 2026

    @lazyalex616
    Author

    @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.8 assistant message with:

    • finish = tool-calls
    • zero structured tool parts
    • assistant text containing pseudo tool-call markup like <invoke ...>

    The follow-up request then effectively ends with assistant and Copilot rejects it with:

    This model does not support assistant message prefill.
    The conversation must end with a user message.
    

    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.

  4. lazyalex616 commented on Jun 21, 2026

    @lazyalex616
    Author

    @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 🐾

  5. github-actions commented on Aug 21, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions