Skip to content

Comments

fix: gracefully handle well-known provider being down#14522

Open
optix2000 wants to merge 1 commit intoanomalyco:devfrom
optix2000:dev
Open

fix: gracefully handle well-known provider being down#14522
optix2000 wants to merge 1 commit intoanomalyco:devfrom
optix2000:dev

Conversation

@optix2000
Copy link

@optix2000 optix2000 commented Feb 21, 2026

Issue for this PR

Closes #10930

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes issue where opencode crashes if a previously authed .well-known/opencode endpoint becomes unavailable.

Actually adds error handling and caching so transient errors, or downtime doesn't brick your opencode.

How did you verify your code works?

  1. Run a localhost/.well-known/opencode stub server,
  2. Run opencode auth login http://localhost
  3. Stop stub server
  4. opencode no longer crashes

Screenshots / recordings

# Server running
% opencode auth login http://localhost:3456

┌  Add credential
│
●  Running `echo stub-token`
│
◆  Logged into http://localhost:3456
│
└  Done

# Server stopped (old behavior)
% opencode
{
  "name": "UnknownError",
  "data": {
    "message": "Error: Unable to connect. Is the computer able to access the url?"
  }
}

% opencode run 'immediately return'
Error: Unexpected error, check log file at /Users/./.local/share/opencode/log/2026-02-21T052204.log for more details

Unable to connect. Is the computer able to access the url?

% bun run --cwd packages/opencode dev run 'immediately return'
$ bun run --conditions=browser ./src/index.ts run "immediately return"

> build · Claude Opus 4.6

Could you clarify what you mean? Are you referring to something in the codebase, a code pattern, or something else?

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Feb 21, 2026
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Feb 21, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

const cached = path.join(Global.Path.cache, "wellknown", key.replaceAll(/[^a-zA-Z0-9.-]/g, "_") + ".json")
log.debug("fetching remote config", { url })
let wellknown: any
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opencode should fall back to cached well-known config when endpoint is temporarily unavailable

2 participants