Skip to content

sap-ai-core: Claude models fail with 400 "does not support assistant message prefill" #45313

Closed as not planned

Description

@Saichandra2520

Bug Report

OpenCode Version: 1.18.23
Provider: sap-ai-core
Model: sap-ai-core/anthropic--claude-4.6-sonnet (affects all sap-ai-core/anthropic--* models)

Description

When using any Anthropic/Claude model through the SAP AI Core provider, every response is followed by a 400 error:

400 - LLM Module: This model does not support assistant message prefill.
The conversation must end with a user message.

Steps to Reproduce

  1. Configure OpenCode with sap-ai-core provider and any anthropic--* model
  2. Send any message (e.g. "Hi")
  3. Receive a response
  4. Observe 400 error immediately after

Root Cause

OpenCode appends a partial assistant message at the end of the conversation (assistant prefill) to steer the model's response. The SAP AI Core Orchestration API rejects this — it requires conversations to always end with a user message.

Relevant source file:
packages/opencode/src/provider/provider.ts — sap-ai-core custom loader

The fix requires stripping any trailing assistant message before sending to SAP AI Core, or disabling prefill specifically for this provider.

Expected Behavior

Messages to SAP AI Core Claude models should not include a trailing assistant message. The conversation should always end with a user message.

Workaround

None currently available via config. The only workaround is to not use Anthropic/Claude models through SAP AI Core.

Activity

  1. github-actions commented on Aug 26, 2026

    @github-actions
    Contributor

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

    Your issue is specific to the SAP AI Core provider, but the underlying cause (OpenCode appending a trailing assistant message that SAP AI Core / Anthropic rejects) is shared with the above. It may be worth coordinating with those threads or checking if an existing fix covers this provider.

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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