Skip to content

acp: set_config_option rejects a configured model selected right after session/new #52472

Closed

Description

@hiddentn

Description

Follow-up to #49630 / #50236, closed as fixed by #52286. On 2.0.21, which includes #52286, an ACP client that selects a model from opencode.json right after session/new still gets -32602 Invalid params: model not found. Sent two seconds later, the same request succeeds.

model.list answers before the location's plugins have registered config providers. So the catalog session/new loads lacks them, and the single reload in withReload before rejecting happens straight away, still too early. The config_option_update arrives a few hundred ms later. Editors cope; clients that pick a model during setup don't.

A fix that keeps catalog reads non-blocking: after that reload, keep following catalog refreshes until the value appears, plugin.updated marks activation done, or 5 s pass. I have it working with wire tests against v2, and can rebase it on #52471 if that helps.

Plugins

None, config only

OpenCode version

2.0.21 (also v2 at cf0c9fb from source)

Steps to reproduce

  1. In an empty directory, an opencode.json with a custom provider: "provider": { "myprovider": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://127.0.0.1:9/v1", "apiKey": "x" }, "models": { "my-model": {} } } }
  2. Run opencode acp there and send initialize, then session/new.
  3. Immediately send session/set_config_option with configId: "model", value: "myprovider/my-model".

Expected: the model is selected. Actual: -32602 model not found: myprovider/my-model.

Screenshot and/or share link

No response

Operating System

Ubuntu (Linux)

Terminal

Raw stdio JSON-RPC client

Activity

  1. github-actions commented on Oct 1, 2026

    @github-actions
    Contributor

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

    • #50236: ACP session/new omitted configured providers from its catalog, causing model availability problems. This report appears to describe a remaining timing race after the fix.
    • #49630: Custom-provider models were missing from the ACP catalog and failed with model not found.
  2. added a commit that references this issue on Oct 3, 2026
  3. nexxeln commented on Oct 6, 2026

    @nexxeln
    Contributor

    Fixed by #53358 on v2. The first session/new now waits until the location's plugins have registered their providers, so a model from opencode.json can be selected right after session/new without -32602. It ships in the next release.

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