Skip to content

Upstream request failed: Invalid credential #57106

Open

Description

@m477r1x

Description

I set up a brand new opencode server docker container on my sandbox host system. I added credit to my opencode Zen account in the default workspace. I connected the opencode web UI from a client laptop and set up a new project and added my API key from my opencode zen account to give access to paid-for models. I chose a paid-for model and attempted to send a test message but received the following error:

Upstream request failed: Invalid credential

I tested with a free tier model and received the same error.

Plugins

No response

OpenCode version

1.19.2

Steps to reproduce

  1. Spin up a docker container of opencode server using the official opencode docker image: ghcr.io/anomalyco/opencode:1.19.3

  2. Connect to the web UI of the host machine running the container image on the correct port number exposed by docker.

  3. Attempt to send a test message

Screenshot

Image

Operating System

macos 26.7.1

Terminal

N/A

Activity

  1. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    Thanks for the report and the screenshot! Version 1.19.x is OpenCode v1, which now only gets critical fixes. Every model failing on a fresh server could count as critical, but first we need to work out whether the gateway is rejecting the key itself or the server is sending the wrong credential. Could you share:

    1. The exact model ID you picked (e.g. opencode/...) for both the paid and the free test.
    2. How you added the API key: through the web UI's provider/connect dialog, an OPENCODE_API_KEY environment variable on the container, or a mounted auth/config file? Was the key created in the same Zen workspace you added credit to? (Please don't paste the key.)
    3. If you remove the stored key (or start a fresh container without one), do the free models work?
    4. Does the same key work outside Docker, e.g. with a local opencode install, or with v2 (@opencode/cli, 2.x)?
    5. Any related lines from the container logs (docker logs <container>) from when you send the message, with secrets redacted.

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.

    These issues look related, ordered from most to least likely. None of them clearly matches your setup:

  2. m477r1x commented on Oct 19, 2026

    @m477r1x
    Author

    i added the key using the web UIs provider connect box. the model Id i tested for paid model was claude sonnet 5.5 and the free model was big pickle. free models appear to work in a fresh container without ad API key added.

    the same key does not work outside of docker, the same error is produced when connecting an opencode account in an iterm2 session with the api key.

    i don't think docker logs are useful since the issue exist outside of docker as well.

  3. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for testing both inside and outside Docker, that narrows it down a lot. Invalid credential means the gateway doesn't recognize the key itself, so it isn't the container: usually the key was revoked, copied incompletely, or belongs to a workspace (or service account) that was deleted.

    The quickest fix is to create a fresh key: in the Console open your account menu → Account → Personal API keys → Add API key, pick the workspace you added credit to, and copy it straight away (it's only shown once). Then reconnect with that key.

    If a brand-new key from that workspace still gives Invalid credential, please email help@anoma.ly with your account email and workspace name so we can look at the account. Closing this here since it's key-specific rather than an OpenCode bug.

  4. opencode-agent commented on Oct 22, 2026

    @opencode-agent
    Contributor

    We're closing this for now because we haven't heard back with the details we asked for: the exact model ID, how the API key was added, whether free models work without the stored key, whether the same key works outside Docker or on v2, and the container logs. Without them we can't tell whether the gateway is rejecting the key itself or the 1.19.x (v1) server is sending the wrong credential. v1 now only gets critical fixes.

    If you still see Upstream request failed: Invalid credential, please reply here with those details and we can reopen this. If it also happens on v2 (@opencode/cli, 2.x), please mention that too. You can also follow #54833 and #50593, which report the same error. Thanks for taking the time to report it!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions