Skip to content

Provider request fails with invalid_request_error and OpenCode does not work #47975

Closed

Description

@muhammad-fiaz

Description

OpenCode is not working when sending requests through the configured provider.

The request fails with the following error:

Error from provider (Console): Upstream request failed: [invalid_request_error] The request contains invalid parameters. Check the request body for any errors or inconsistencies.

Plugins

No plugins.

OpenCode version

1.18.29

Steps to reproduce

  1. Open OpenCode.
  2. Configure and select the affected provider and model.
  3. Start a new conversation.
  4. Send a message to the model.
  5. The request fails with the following error:
Error from provider (Console): Upstream request failed: [invalid_request_error] The request contains invalid parameters. Check the request body for any errors or inconsistencies.

Screenshot and/or share link

Image

Operating System

Windows

Terminal

Windows Terminal

Activity

  1. crisalexmata commented on Sep 10, 2026

    @crisalexmata

    This is also happening to me, switching between Muse Spark 1.3 Contributor (Go) and Muse Spark 1.3 Free will not fix it either.

  2. muhammad-fiaz commented on Sep 10, 2026

    @muhammad-fiaz
    Author

    @crisalexmata I tried deleting all OpenCode data and sessions. It works temporarily, and starting a new session also works temporarily, but the issue eventually comes back. It seems to happen more often with long running sessions. I suspect OpenCode may be sending an incorrect API header or request configuration after the session has been running for a while. It may be worth checking whether provider state, API headers, or request configuration is being incorrectly persisted or reused.

    Also, 1.18.30 seems to have the similar issue as #48297, which has already been reported.

  3. AlfredWang777 commented on Sep 17, 2026

    @AlfredWang777

    Root cause found for this generic 400, at least for muse-spark-* on OpenCode Go / Zen.

    The Console gateways advertise max as a supported reasoning effort but reject it upstream with exactly the generic message from this issue.

    Minimal repro against https://opencode.ai/zen/go/v1/responses (no tools, no history, one message):

    curl https://opencode.ai/zen/go/v1/responses \
      -H "Authorization: Bearer $OPENCODE_API_KEY" \
      -H "content-type: application/json" \
      -d '{"model":"muse-spark-1.3-contributor","input":[{"role":"user","content":[{"type":"input_text","text":"hi"}]}],"max_output_tokens":16,"reasoning":{"effort":"max"}}'

    Observed results:

    reasoning.effort result
    omitted 200
    minimal (checked via none error listing) supported
    high 200
    xhigh 200
    max 400 generic invalid_request_error (see below)
    none 400 reasoning_effort 'none' is not supported for model 'muse-spark-1.3-contributor'. Supported values: [minimal, low, medium, high, xhigh, max]

    effort: "max" returns exactly the message from this issue:

    {"model":"muse-spark-1.3-contributor","error":{"param":null,"type":"invalid_request_error","message":"Error from provider (Console Go): Upstream request failed: [invalid_request_error] The request contains invalid parameters. Check the request body for any errors or inconsistencies."}}

    So the validator lists max as supported but the request is still rejected — looks like a gateway/upstream bug on the top tier.

    Why OpenCode users hit this: agent-level options.reasoningEffort is forwarded to whatever model is selected, so any agent that pins reasoningEffort: "max" (typically for another model) makes every muse-spark-* request fail on turn 1. Reproduced end-to-end on 1.18.31:

    • default build agent (options.reasoningEffort: max) + -m opencode-go/muse-spark-1.3-contributor → same 400 on the first message
    • same run with --variant xhigh → succeeds
    • same run with a dedicated agent using options.reasoningEffort: "xhigh" → succeeds

    Workaround until fixed: for Muse Spark, use variant xhigh (or an agent configured with high/xhigh); never send effort: max to these models.

  4. rekram1-node commented on Sep 19, 2026

    @rekram1-node
    Collaborator

    fixed in models.dev

  5. muhammad-fiaz commented on Sep 19, 2026

    @muhammad-fiaz
    Author

    fixed in models.dev

    @rekram1-node does it work with current opencode release version currently now??

  6. muhammad-fiaz commented on Sep 19, 2026

    @muhammad-fiaz
    Author

    @rekram1-node I’m using OpenCode 1.18.31, but I’m still experiencing the same issue during long-running sessions when using OpenCode through Zed’s ACP integration.

    This is specifically happening with the Zed ACP setup:

    Image
  7. ayushch80 commented on Sep 24, 2026

    @ayushch80

    Issue still exists in OpenCode 1.18.32. And sometimes hitting this error in mid-conversations.

    Image
  8. Not-A-Normal-Robot commented on Oct 3, 2026

    @Not-A-Normal-Robot

    Issue still exists in opencode v2.0.22 with muse spark 1.3 free

  9. farrizdesignpro1339 commented on Oct 3, 2026

    @farrizdesignpro1339

    just use /compat and normal again

  10. ctlssr commented on Oct 9, 2026

    @ctlssr

    14. just use /compat and normal again

    Best answer. Also happened to me at 97%, /compact solved it.

  11. Not-A-Normal-Robot commented on Oct 9, 2026

    @Not-A-Normal-Robot

    That's not a solution—that's a workaround. It only addresses the symptom and not the root cause.

  12. Kauid323 commented on Oct 10, 2026

    @Kauid323

    Still error, especially model Muse Spark 1.3 has reached 910,000 context

    in OpenCode 2.0.22 Desktop
    opencode-debug-20261010T184344.zip

  13. grilero commented on Oct 13, 2026

    @grilero

    Same here with 2.0.28 on muse spark 1.3 free

  14. darman-a11y commented on Oct 15, 2026

    @darman-a11y

    Crazy how many bugs get maliciously ignored

  15. rekram1-node commented on Oct 16, 2026

    @rekram1-node
    Collaborator

    Definitely not "maliciously ignored" I didn't see any messages in here nor have I received reports of this personally so I am only just now seeing this.

    I'll see if I can reproduce I think it's just Meta not giving a good error when the compaction limit is reached, would also say that the latest 2.0.30+ have some additional fixes for compaction should make it trigger a bit earlier, ill see if meta can give a better error if the context overflows.

    if this isnt context related plz provide more info so I can reproduce

  16. muhammad-fiaz commented on Oct 16, 2026

    @muhammad-fiaz
    Author

    @rekram1-node This issue seems to occur with the Muse Spark 1.3 contributor (max) in long-running sessions. Creating a new session and running the AI agent again seems to work fine, but the issue appears after using the same session for an extended period. It also seems to occur with both ACP and the OpenCode CLI. However, the behavior may vary for others, so further investigation and information from other users would help identify the root cause.

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