Skip to content

[Bug] parseModel breaks URL-based provider IDs used by opencode auth login #39926

Description

@simcop2387

Description

First a disclosure, I've looked through the rest of this report and it make sense to me and it's what i suspected when I first encountered the issue, but I didn't understand opencode's architecture well enough to find the details about it so I gave just the symptoms to Qwen3.6-27B and had it chew on the issue with just the symptoms (not my original suspicsion) until it came to the same conclusion and had some real code references. Then I took that report and gave it to Qwen3.5-122B alone with no other context except to try to verify what it came up with. I don't really trust that the fix is actually a good fix but at the very least the problem that they're pointing to looks right. In my case the resulting provider is https://<subdomain>.simcop2387.info and the model id thinking-coding:Qwen3.6-27B-DFlash:high.

Running the skills via opencode run ... does work fine.

---BEGIN AI SLOP REPORT---
When using opencode auth login <url> to authenticate with a custom provider (e.g., a LiteLLM proxy), skill/command invocations fail with ProviderModelNotFoundError because Provider.parseModel() incorrectly splits URL-based provider IDs on /.

Symptom: Normal chat streaming works fine, but any skill/command (like /wayfinder) fails with an error like:

ProviderModelNotFoundError: Model not found: https:/litellm.example.com/thinking-coding:Qwen3.6-27B-DFlash:high

Root cause: The provider ID is the full URL (e.g., https://litellm.example.com), but parseModel() splits the model string on the first /, producing:

  • providerID = "https:" (incorrect)
  • modelID = "/litellm.example.com/model:variant" (incorrect)

The lookup then fails because s.providers["https:"] doesn't exist; the provider is actually registered under s.providers["https://litellm.example.com"].

Plugins

No plugins, just any skill files

OpenCode version

1.18.10

Steps to reproduce

  1. Run opencode auth login https://llm.example.com to set up a well-known provider with a URL-based provider ID # ED: This is using the /.well-known/opencode setup resulting in an auth.json that looks like this:
{
  "https://llm.example.com": {
    "type": "wellknown",
    "key": "BLAHBLAHBLAH_API_KEY",
    "token": "<secret goes here>"
  }
}
  1. Start a session and verify normal chat streaming works
  2. Invoke any skill/command like /wayfinder or /summarize
  3. Command fails with ProviderModelNotFoundError showing a corrupted provider ID (https://... instead of https://...)

Screenshot and/or share link

Best bit for this is the log, but a small popup does show in the TUI:

timestamp=2026-07-31T13:56:32.149Z level=INFO run=20a58cab message=cleanup prune=7.days
timestamp=2026-07-31T13:56:38.565Z level=INFO run=20a58cab message=command session.id=ses_0478a86c9ffeoAzJp54NiHyNpo command=wayfinder agent=build
timestamp=2026-07-31T13:56:38.571Z level=ERROR run=20a58cab message=failed ref=err_8d2e3539 error="ProviderModelNotFoundError: Model not found: https://llm.example.com/thinking-coding:Qwen3.6-27B-DFlash:high. Did you mean: https://llm.example.com?" cause="ProviderModelNotFoundError: Model not found: https://llm.exaple.com/thinking-coding:Qwen3.6-27B-DFlash:high. Did you mean: https://llm.example.com?\n    at <anonymous> (/$bunfs/root/chunk-gyyjzt70.js:439:93471)\n    at SessionPrompt.getModel (/$bunfs/root/chunk-p3c4rg04.js:1087:466)\n    at SessionPrompt.getModel (definition) (/$bunfs/root/chunk-p3c4rg04.js:1085:908)\n    at SessionPrompt.command (/$bunfs/root/chunk-z3jd9vry.js:4:13932)\n    at SessionPrompt.command (definition) (/$bunfs/root/chunk-p3c4rg04.js:1085:15454)\n    at SessionHttpApi.command (/$bunfs/root/chunk-z3jd9vry.js:2:84381)\n    at SessionHttpApi.command (definition) (/$bunfs/root/chunk-z3jd9vry.js:4:13842)"
timestamp=2026-07-31T14:28:43.802Z level=INFO run=903b2e77 message="loading tui config" path=/home/ryan/workspace/opencode/.opencode/tui.json
timestamp=2026-07-31T14:28:43.809Z level=INFO run=903b2e77 message="applying tui config" path=/home/ryan/workspace/opencode/.opencode/tui.json order=1

Operating System

Debian Forky (Linux)

Terminal

Konsole

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