Skip to content

Expired enterprise auth token makes opencode unrecoverable (cryptic decode error + can't re-login) #31649

Closed

Description

@Ayushlm10

Description

We host our enterprise config behind Cloudflare Access, discovered via the wellknown
auth type (<origin>/.well-known/opencode → remote_config). When the stored token
expires, opencode gets stuck and can't recover on its own:

  • Access answers the unauthenticated request with its HTML login page and HTTP 200.
    opencode's remote-config fetch accepts the 200, then fails to JSON-decode the HTML and
    dies, so startup aborts with failed to decode remote config ... Decode error (200)
    and a raw stack trace.
  • opencode auth login <url> can't fix it either: it bootstraps the project first, which
    loads that same remote config with the expired token and crashes before the login flow
    runs. The only workaround is rm ~/.local/share/opencode/auth.json, then re-login.

Seen since ~1.14.40 (when enterprise config moved behind Access)

Plugins

No response

OpenCode version

1.16.2

Steps to reproduce

  1. opencode auth login <enterprise-url> to set up wellknown auth.
  2. Let the token expire (or put an invalid token in auth.json).
  3. Run opencode → fatal Decode error (200) with a stack trace.
  4. Run opencode auth login <enterprise-url> to recover → it also crashes; you have to
    delete auth.json first.

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Ghostty

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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