Skip to content

This model does not support assistant message prefill / Github Copilot with Opus 4.6 #13768

Closed as not planned

Description

@sbrunecker

Description

Working with Opus 4.6, opencode frequently stops with the message "This model does not support assistant message prefill. The conversation must end with a user message."

This is from the session export:

    {
      "info": {
        "role": "assistant",
        "time": {
          "created": 1771187182207,
          "completed": 1771187184086
        },
        "error": {
          "name": "APIError",
          "data": {
            "message": "This model does not support assistant message prefill. The conversation must end with a user message.",
            "statusCode": 400,
            "isRetryable": false,
            "responseHeaders": {
              "cache-control": "no-cache",
              "content-security-policy": "default-src 'none'; sandbox",
              "content-type": "text/plain; charset=utf-8",
              "date": "Sun, 15 Feb 2026 20:26:23 GMT",
              "strict-transport-security": "max-age=31536000",
              "transfer-encoding": "chunked",
              "x-content-type-options": "nosniff",
              "x-github-backend": "Kubernetes",
              "x-github-request-id": "EAAC:14EF1C:253883:31B9E3:69922BEC",
              "x-request-id": "00000-ce7fe972-c41c-43ec-b02b-3d2299740ab9"
            },
            "responseBody": "{\"error\":{\"message\":\"This model does not support assistant message prefill. The conversation must end with a user message.\",\"code\":\"invalid_request_body\"}}\n",
            "metadata": {
              "url": "https://api.githubcopilot.com/chat/completions"
            }
          }
        },
        "parentID": "msg_c62f2be7600192uMJUKpSsJ0qr",
        "modelID": "claude-opus-4.6",
        "providerID": "github-copilot",
        "mode": "build",
        "agent": "build",
        "path": {
          "cwd": "/home/stefan/projects/odoo18",
          "root": "/home/stefan/projects/odoo18"
        },
        "cost": 0,
        "tokens": {
          "input": 0,
          "output": 0,
          "reasoning": 0,
          "cache": {
            "read": 0,
            "write": 0
          }
        },
        "id": "msg_c62fb9a7f001Rl3UkWhXmVKLb7",
        "sessionID": "ses_39d0d418cffeIz9g6wg7wg1Caj"
      },
      "parts": []
    }

Plugins

none

OpenCode version

1.2.4

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Feb 15, 2026

    @github-actions
    Contributor

    This issue appears to be a duplicate of an existing issue. Please check:

    • Github Copilot / Opus 4.6 Error #12337: Github Copilot / Opus 4.6 Error - reports the same "This model does not support assistant message prefill" error with Opus 4.6 on GitHub Copilot (already closed)
  2. rekram1-node commented on Feb 15, 2026

    @rekram1-node
    Contributor

    Can you share output of opencode debug config

  3. sbrunecker commented on Feb 15, 2026

    @sbrunecker
    Author
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "odoo18-postgres-local": {
          "type": "remote",
          "url": "http://localhost:8018/sse"
        },
        "odoo18-postgres-devserver": {
          "type": "remote",
          "url": "http://localhost:8028/sse"
        },
        "chrome-devtools": {
          "type": "local",
          "command": [
            "npx",
            "-y",
            "chrome-devtools-mcp@latest",
            "--executablePath=/usr/bin/google-chrome"
          ]
        }
      },
      "agent": {
        "odoo-migration": {
          "prompt": "...",
          "description": "Primary agent for major Odoo version migrations.",
          "name": "odoo-migration",
          "type": "primary",
          "options": {
            "type": "primary"
          },
          "permission": {}
        },
        "odoo-primary": {
          "prompt": "...",
          "description": "Primary agent for Odoo customizations and migrations.",
          "name": "odoo-primary",
          "type": "primary",
          "options": {
            "type": "primary"
          },
          "permission": {}
        }
      },
      "mode": {},
      "plugin": [],
      "command": {},
      "username": "stefan",
      "keybinds": {
        "leader": "ctrl+x",
        "app_exit": "ctrl+c,ctrl+d,<leader>q",
        "editor_open": "<leader>e",
        "theme_list": "<leader>t",
        "sidebar_toggle": "<leader>b",
        "scrollbar_toggle": "none",
        "username_toggle": "none",
        "status_view": "<leader>s",
        "session_export": "<leader>x",
        "session_new": "<leader>n",
        "session_list": "<leader>l",
        "session_timeline": "<leader>g",
        "session_fork": "none",
        "session_rename": "ctrl+r",
        "session_delete": "ctrl+d",
        "stash_delete": "ctrl+d",
        "model_provider_list": "ctrl+a",
        "model_favorite_toggle": "ctrl+f",
        "session_share": "none",
        "session_unshare": "none",
        "session_interrupt": "escape",
        "session_compact": "<leader>c",
        "messages_page_up": "pageup,ctrl+alt+b",
        "messages_page_down": "pagedown,ctrl+alt+f",
        "messages_line_up": "ctrl+alt+y",
        "messages_line_down": "ctrl+alt+e",
        "messages_half_page_up": "ctrl+alt+u",
        "messages_half_page_down": "ctrl+alt+d",
        "messages_first": "ctrl+g,home",
        "messages_last": "ctrl+alt+g,end",
        "messages_next": "none",
        "messages_previous": "none",
        "messages_last_user": "none",
        "messages_copy": "<leader>y",
        "messages_undo": "<leader>u",
        "messages_redo": "<leader>r",
        "messages_toggle_conceal": "<leader>h",
        "tool_details": "none",
        "model_list": "<leader>m",
        "model_cycle_recent": "f2",
        "model_cycle_recent_reverse": "shift+f2",
        "model_cycle_favorite": "none",
        "model_cycle_favorite_reverse": "none",
        "command_list": "ctrl+p",
        "agent_list": "<leader>a",
        "agent_cycle": "tab",
        "agent_cycle_reverse": "shift+tab",
        "variant_cycle": "ctrl+t",
        "input_clear": "ctrl+c",
        "input_paste": "ctrl+v",
        "input_submit": "return",
        "input_newline": "shift+return,ctrl+return,alt+return,ctrl+j",
        "input_move_left": "left,ctrl+b",
        "input_move_right": "right,ctrl+f",
        "input_move_up": "up",
        "input_move_down": "down",
        "input_select_left": "shift+left",
        "input_select_right": "shift+right",
        "input_select_up": "shift+up",
        "input_select_down": "shift+down",
        "input_line_home": "ctrl+a",
        "input_line_end": "ctrl+e",
        "input_select_line_home": "ctrl+shift+a",
        "input_select_line_end": "ctrl+shift+e",
        "input_visual_line_home": "alt+a",
        "input_visual_line_end": "alt+e",
        "input_select_visual_line_home": "alt+shift+a",
        "input_select_visual_line_end": "alt+shift+e",
        "input_buffer_home": "home",
        "input_buffer_end": "end",
        "input_select_buffer_home": "shift+home",
        "input_select_buffer_end": "shift+end",
        "input_delete_line": "ctrl+shift+d",
        "input_delete_to_line_end": "ctrl+k",
        "input_delete_to_line_start": "ctrl+u",
        "input_backspace": "backspace,shift+backspace",
        "input_delete": "ctrl+d,delete,shift+delete",
        "input_undo": "ctrl+-,super+z",
        "input_redo": "ctrl+.,super+shift+z",
        "input_word_forward": "alt+f,alt+right,ctrl+right",
        "input_word_backward": "alt+b,alt+left,ctrl+left",
        "input_select_word_forward": "alt+shift+f,alt+shift+right",
        "input_select_word_backward": "alt+shift+b,alt+shift+left",
        "input_delete_word_forward": "alt+d,alt+delete,ctrl+delete",
        "input_delete_word_backward": "ctrl+w,ctrl+backspace,alt+backspace",
        "history_previous": "up",
        "history_next": "down",
        "session_child_cycle": "<leader>right",
        "session_child_cycle_reverse": "<leader>left",
        "session_parent": "<leader>up",
        "terminal_suspend": "ctrl+z",
        "terminal_title_toggle": "none",
        "tips_toggle": "<leader>h",
        "display_thinking": "none"
      }
    }
    
  4. hsuanguo commented on Feb 15, 2026

    @hsuanguo

    I can confirm I have the same issue, with the latest opencode,
    It was said that this feature is removed from opus 4.6 https://www.reddit.com/r/LLMDevs/comments/1r0ih5p/opus_removes_lastassistantturn_prefill_you_can_no/

  5. rekram1-node commented on Feb 16, 2026

    @rekram1-node
    Contributor
    Image

    Hm I cant replicate

  6. rekram1-node commented on Feb 16, 2026

    @rekram1-node
    Contributor

    can u send a session? opencode export > session.json

  7. Yiximail commented on Feb 16, 2026

    @Yiximail

    I can reproduce this issue and have identified the root cause: it's web-mode specific.

    Key Finding

    In opencode web mode, after each assistant response completes, OpenCode automatically sends a second, empty assistant turn (containing only step-start + step-finish, no text content). This phantom message causes the conversation to end with an assistant message, which then triggers the "assistant message prefill" error on the next request.

    CLI/TUI mode does NOT have this problem — the same models work perfectly there.

    Evidence from SQLite

    Session ses_39b0e7c9cffefZN9W4wuV6sIJx, message sequence:

    [13:34:35] user      → "测试对话,收到请直接回复 收到"
    [13:34:35] assistant → step-start, reasoning, text("收到"), step-finish  ← normal response
    [13:34:38] assistant → (empty, no parts)                                 ← phantom message ⚠️
    
    [13:35:20] user      → same prompt (switched to grok model)
    [13:35:20] assistant → step-start, text("收到"), step-finish             ← normal response  
    [13:35:29] assistant → step-start, step-finish (no text)                 ← phantom message ⚠️
    

    The phantom assistant messages have distinctive characteristics:

    • Negative cost: -0.0025166
    • Negative input tokens: -25197
    • Double cache reads: 50446 (vs normal ~25000)
    • Only step-start + step-finish, no text content

    Steps to Reproduce

    1. opencode web --port 4196
    2. Open web UI, send any message
    3. After response, check SQLite DB → phantom empty assistant message exists
    4. Send another message with a model that doesn't support prefill → 400 error

    Tested on v1.2.4 and v1.2.5, both reproduce in web mode only.

  8. rekram1-node commented on Feb 16, 2026

    @rekram1-node
    Contributor

    can u send the session? Can you show me opencode debug config

  9. Yiximail commented on Feb 16, 2026

    @Yiximail

    @rekram1-node Here's the session export and debug config:

    Session export (220KB, uploaded as gist):
    https://gist.github.com/Yiximail/c1881769ce64ed0ba693858314bd59f1

    opencode debug config:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": [
        "opencode-antigravity-auth@latest",
        "opencode-pty"
      ]
    }

    (Full provider/model config is auto-generated by the antigravity auth plugin — the models themselves work fine in CLI mode, the issue is only in web mode generating phantom assistant messages.)

    Note: The session was exported from SQLite directly since opencode export requires an active TUI session. The format matches the standard export structure with info + parts per message.

  10. Yiximail commented on Feb 16, 2026

    @Yiximail

    @rekram1-node Here's the full opencode debug config:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": [
        "opencode-antigravity-auth@latest",
        "opencode-pty"
      ],
      "provider": {
        "google": {
          "models": {
            "antigravity-gemini-3-pro": {
              "name": "Gemini 3 Pro (Antigravity)",
              "limit": { "context": 1048576, "output": 65535 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] },
              "variants": { "low": { "thinkingLevel": "low" }, "high": { "thinkingLevel": "high" } }
            },
            "antigravity-gemini-3-flash": {
              "name": "Gemini 3 Flash (Antigravity)",
              "limit": { "context": 1048576, "output": 65536 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] },
              "variants": { "minimal": { "thinkingLevel": "minimal" }, "low": { "thinkingLevel": "low" }, "medium": { "thinkingLevel": "medium" }, "high": { "thinkingLevel": "high" } }
            },
            "antigravity-claude-sonnet-4-5": {
              "name": "Claude Sonnet 4.5 (Antigravity)",
              "limit": { "context": 180000, "output": 64000 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] }
            },
            "antigravity-claude-sonnet-4-5-thinking": {
              "name": "Claude Sonnet 4.5 Thinking (Antigravity)",
              "limit": { "context": 180000, "output": 64000 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] },
              "variants": { "low": { "thinkingConfig": { "thinkingBudget": 8192 } }, "max": { "thinkingConfig": { "thinkingBudget": 32768 } } }
            },
            "antigravity-claude-opus-4-5-thinking": {
              "name": "Claude Opus 4.5 Thinking (Antigravity)",
              "limit": { "context": 180000, "output": 64000 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] },
              "variants": { "low": { "thinkingConfig": { "thinkingBudget": 8192 } }, "max": { "thinkingConfig": { "thinkingBudget": 32768 } } }
            },
            "antigravity-claude-opus-4-6-thinking": {
              "name": "Claude Opus 4.6 Thinking (Antigravity)",
              "limit": { "context": 180000, "output": 64000 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] },
              "variants": { "low": { "thinkingConfig": { "thinkingBudget": 8192 } }, "max": { "thinkingConfig": { "thinkingBudget": 32768 } } }
            },
            "gemini-2.5-flash": {
              "name": "Gemini 2.5 Flash (Gemini CLI)",
              "limit": { "context": 1048576, "output": 65536 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] }
            },
            "gemini-2.5-pro": {
              "name": "Gemini 2.5 Pro (Gemini CLI)",
              "limit": { "context": 1048576, "output": 65536 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] }
            },
            "gemini-3-flash-preview": {
              "name": "Gemini 3 Flash Preview (Gemini CLI)",
              "limit": { "context": 1048576, "output": 65536 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] }
            },
            "gemini-3-pro-preview": {
              "name": "Gemini 3 Pro Preview (Gemini CLI)",
              "limit": { "context": 1048576, "output": 65535 },
              "modalities": { "input": ["text","image","pdf"], "output": ["text"] }
            }
          }
        }
      },
      "mcp": {
        "playwright": {
          "type": "local",
          "command": ["npx", "-y", "@playwright/mcp@latest"],
          "enabled": true
        },
        "brave-search": {
          "type": "local",
          "command": ["npx", "-y", "@brave/brave-search-mcp-server", "--transport", "stdio"],
          "environment": { "BRAVE_API_KEY": "[REDACTED]" },
          "enabled": true
        },
        "figma-mcp": {
          "type": "remote",
          "url": "https://mcp.figma.com/mcp",
          "enabled": true
        }
      },
      "permission": {
        "external_directory": {
          "~/Documents/**": "allow",
          "~/.config/opencode/**": "allow"
        }
      }
    }

    The models are all injected by the opencode-antigravity-auth plugin. The issue reproduces across all of them in web mode.

  11. rekram1-node commented on Feb 16, 2026

    @rekram1-node
    Contributor

    You are using antigravity models there and I dont see anything weird, I think there is a bug for that specific issue in the antigravity provider perhaps? Because it looks like u sent a message to opus 4.6 on antigravity, it replied, then u sent another and it errored.

  12. 55 remaining items

  13. removed
    bugSomething isn't working
    on May 3, 2026
  14. lteixeira-pcm commented on May 4, 2026

    @lteixeira-pcm

    Running into this a lot today myself - Opencode 1.14.33 + Opus 4.6 via opencode web.

  15. J-Light commented on May 12, 2026

    @J-Light

    I no longer seem to have this issues.

    $ opencode --version
    1.14.48
    
  16. J-Light commented on May 13, 2026

    @J-Light

    Never mind my last comment. This is back. Not sure why this has been an issue for so long. Aren't anyone using Opus models not seeing this consistently? Is this something most are just living with by saying continue.

    Asking to understand if this may be an environment specific bug, would make sense if its low priority then. From looking at the various similar open issues, looks like Google Vertex AI and GitHub Copilot also experience this not just AWS Bedrock.

    undefined: The model returned the following errors: This model does not support assistant message prefill. The conversation must end with a user message.
    
  17. NewbiZ commented on May 13, 2026

    @NewbiZ

    Aren't anyone using Opus models not seeing this consistently? Is this something most are just living with by saying continue.

    I see it constantly. Opus is not usable on OpenCode until this is fixed, at least for me. And yes, I used to say "proceed" to force it to retry, but even that didnt work reliably, I often had to switch model and then switch back. I switched to Kimi 2.6 in the meantime.

  18. Frank-III commented on May 16, 2026

    @Frank-III
    Sponsor

    Still encounter this issue using with anthropic api key. the subagent would early return and the main agent would behave poorly

    wondering any workaround for this?

  19. NewbiZ commented on May 18, 2026

    @NewbiZ

    Interestingly, using Opus 4.7 through OpenRouter, the error message is different, it is now Provider returned error. When looking at the logs, I can see the root cause as:

    HTTP 400 from OpenRouter (upstream: Anthropic)
    "This model does not support assistant message prefill.
     The conversation must end with a user message."
    ```.
    
  20. J-Light commented on May 20, 2026

    @J-Light

    In general I am seeing fewer issues with Opus 4.7 . I am carrying a patch manually for prefill errors

  21. wstuckey commented on May 29, 2026

    @wstuckey

    Can confirm that this is still an issue for me as well

  22. hsuanguo commented on May 31, 2026

    @hsuanguo

    I rebased #14772, as I suggested earlier, I think we can merge this PR as a temporary solution(if there is no proper solution soon), this issue has been here for too long, the PR itself should not have much side affects @rekram1-node

  23. hsuanguo commented on Jul 3, 2026

    @hsuanguo

    are there any plan to address this issue at all then? or it is fixed already? it has been quite a while already

  24. github-actions commented on Sep 2, 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.

  25. fake-name commented on Sep 22, 2026

    @fake-name

    Well that bot is 100% useless and actively harmful.

  26. soar commented on Oct 2, 2026

    @soar

    This is still an issue and it still happens even on Opus 5.5

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