Skip to content

Opencode Desktop error with nushell as default shell #8716

Closed

Description

@fraluc06

Description

When I start the desktop version of Opencode, I receive this message: Error: Failed to spawn OpenCode Server. Logs:
[STDERR] Error: nu::parser::parse_mismatch
[STDERR]
[STDERR] x Parse mismatch during operation.
[STDERR] ,-[source:1:58]
[STDERR] 1 | "/Applications/OpenCode.app/Contents/MacOS/opencode-cli" serve --port 53854
[STDERR] : ^^|^^
[STDERR] : -- expected operator [STDERR] ----
[STDERR]

zu@tauri://localhost/assets/index-D-5zzoZR.js:2:11977
@tauri://localhost/assets/index-D-5zzoZR.js:2:4664

This issue wasadded I think after 1.1.20 (or near that version). Prior to that, even with nushell as default shell, the desktop app worked fine

Plugins

No response

OpenCode version

1.1.21

Steps to reproduce

  1. Set nushell as default shell
  2. Reboot device
  3. Open Opencode Desktop

Screenshot and/or share link

No response

Operating System

macOS 26.2

Terminal

Ghostty

Activity

  1. aciceri commented on Feb 20, 2026

    @aciceri

    I've hit the same issue on NixOS with nushell as $SHELL.

    The root cause is in packages/desktop/src-tauri/src/cli.rs — the spawn_command function wraps the sidecar invocation in $SHELL -il -c "..." on Unix, but nushell doesn't support combining --login with -c/--commands (it silently exits with code 1).

    There's already a partial nushell workaround (the shell.ends_with("/nu") branch that adds ^ for external command syntax), but it still passes -il to nushell, which doesn't help.

    However, I don't think spawning through the user's shell is necessary at all. The sidecar path is absolute, and the Windows (non-WSL) branch already invokes it directly:

    // Windows non-WSL (lines 302-310) — already works fine
    let sidecar = get_sidecar_path(app);
    let mut cmd = Command::new(sidecar);
    cmd.args(args.split_whitespace());

    The fix would be to do the same on Unix — drop the $SHELL -il -c wrapper entirely:

    } else {
        let sidecar = get_sidecar_path(app);
        let mut cmd = Command::new(sidecar);
        cmd.args(args.split_whitespace());
    
        for (key, value) in envs {
            cmd.env(key, value);
        }
    
        cmd
    };

    This removes the dependency on $SHELL being POSIX-compatible and eliminates potential issues with other non-standard shells (nushell, fish edge cases, etc.). The get_user_shell() function can then be removed as dead code.

    Happy to open a PR if this approach seems reasonable.

    PS: OpenCode acutally wrote this message on its own initiative without even asking my permission...however it reflects what I think. Unless there is a good reason which I can't see on why it has been done like that.

    Starting it with SHELL=/run/current-system/sw/bin/bash OpenCode is workaround that seems to work.

  2. github-actions commented on Apr 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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 workingwebRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions