Skip to content

opencode run fails with Session not found when OPENCODE_SERVER_PASSWORD is set #24204

Closed

Description

@rmk40

Description

`opencode run` fails immediately with `Error: Session not found` when `OPENCODE_SERVER_PASSWORD` is present in the environment.

This is reproducible without any model-specific behavior. The command succeeds after unsetting the server auth env vars.

Related: #14532 is closed; this issue provides a current minimal repro on `1.14.24` for the remaining `opencode run` path.

Plugins

None.

OpenCode version

1.14.24

Steps to reproduce

  1. Set a server password in the shell environment:

```bash
export OPENCODE_SERVER_PASSWORD=secret
```

  1. Run:

```bash
opencode run "Reply with exactly OK."
```

  1. Observe:

```text
Error: Session not found
```

  1. Run the same command after unsetting the server auth env vars:

```bash
env -u OPENCODE_SERVER_PASSWORD -u OPENCODE_SERVER_USERNAME \
opencode run "Reply with exactly OK."
```

  1. Observe that `opencode run` proceeds normally.

Expected: `opencode run` should work when `OPENCODE_SERVER_PASSWORD` is set, or at least authenticate its own in-process server requests consistently with the server auth config.

Actual: the in-process server rejects the SDK client's session creation request, and the CLI reports `Session not found`.

Screenshot and/or share link

N/A

Operating System

macOS 26.4.1 arm64

Terminal

zsh / shell environment

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 24, 2026
  2. github-actions commented on Apr 24, 2026

    @github-actions
    Contributor

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

    If your issue is distinct from the above, please add a note clarifying how it differs.

  3. rmk40 commented on Apr 24, 2026

    @rmk40
    ContributorAuthor

    Clarifying the duplicate suggestions:

    The linked PR targets only the plain opencode run in-process SDK client path.

  4. rayborg commented on Apr 28, 2026

    @rayborg

    Additional confirmation on current versions:

    • CLI: 1.14.28
    • Desktop app: 1.14.28
    • OS: macOS 26.4, arm64
    • Terminal/shell: zsh

    This also happens naturally from an OpenCode Desktop-inherited process environment. Desktop starts its local sidecar with an ephemeral OPENCODE_SERVER_PASSWORD, and child shell/CLI processes can inherit that variable. A local non---attach opencode run then fails with Error: Session not found.

    Minimal repro still works with a dummy password on 1.14.28:

    OPENCODE_SERVER_PASSWORD=dummy-password-for-repro opencode run -m openai/gpt-5.5-fast --variant xhigh "Reply exactly: OK"
    # Error: Session not found
    
    env -u OPENCODE_SERVER_PASSWORD opencode run -m openai/gpt-5.5-fast --variant xhigh "Reply exactly: OK"
    # OK
    

    No real secret values involved; this is just confirming the issue persists on 1.14.28 and documenting the Desktop inheritance path.

  5. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. hades200082 commented on May 27, 2026

    @hades200082

    Same issue here. Prevents open-ralph-wiggum from working.

    Th0rgal/open-ralph-wiggum#84

  7. rmk40 commented on May 27, 2026

    @rmk40
    ContributorAuthor

    There does not seem to be much appetite for outside PRs, so I've stopped pursuing trying to land this and other fixes.

  8. blairhudson commented on May 29, 2026

    @blairhudson

    This is actually an issue more generally for running opencode with --mdns or --hostname. I've flagged separately in #29847 29847 before I saw this issue.

  9. OpeOginni commented on May 29, 2026

    @OpeOginni
    Contributor

    Worked on the other Issue, got a PR for this issue as well

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