Skip to content

opencode attach --dir fails because it tries to change directory on the client instead of the server #8933

Closed as duplicate

Description

@nyxkrage

Description

When using opencode attach with the --dir flag to connect to a remote server, the command fails because it attempts to change the directory on the local client machine rather than sending the directory path to the server.

The attach command handler calls process.chdir(args.dir) locally before connecting, which fails if the specified directory doesn't exist on the client. Even if it does exist, it passes process.cwd() as the directory to the tui function, so the resolved local path is sent to the server, which is unexpected.

Expected behavior

The --dir flag should be passed to the remote server, which resolves the path relative to where opencode serve was started.

Plugins

N/A

OpenCode version

dev @ 88fd6a2

Steps to reproduce

  1. Start opencode serve on a remote server (e.g., Linux machine in /home/user)
  2. On the remote server, ensure a project directory exists (e.g., my-project)
  3. From a local machine (e.g., macOS), run opencode attach http://:4096 --dir my-project
  4. Observe the error: ENOENT: no such file or directory, chdir '' -> 'my-project'

Screenshot and/or share link

No response

Operating System

N/A

Terminal

N/A

Activity

  1. github-actions commented on Jan 16, 2026

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case.

  2. nyxkrage commented on Jan 16, 2026

    @nyxkrage
    ContributorAuthor

    Ah yes, this seems to be a duplicate of the first one listed. I assume it didn't come up in my because I searched for the full ENOENT error?

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions