opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Desktop app fails to start on Linux/Wayland - 'open terminal failed: not a terminal'

Open justindotdevv opened this issue 10 months ago • 6 comments

System Information

  • OpenCode version: 1.1.25 (both TUI and desktop)
  • Package: opencode-desktop-bin 1.1.25-1 from AUR
  • OS: Arch Linux (Omarchy)
  • Kernel: 6.18.5-arch1-1
  • Desktop: Hyprland 0.53.1 (Wayland compositor)

Description

The OpenCode desktop app (Tauri-based) fails to start with terminal-related errors when launched on a Wayland system.

Error Message

Error: Failed to spawn OpenCode Server. Logs:
[STDERR] bash: cannot set terminal process group (2657565): Inappropriate ioctl for device
[STDERR] bash: no job control in this shell
[STDERR] open terminal failed: not a terminal

The error originates from tauri://localhost/assets/index-D9T6R7qf.js.

Expected Behavior

The desktop app should launch and spawn the OpenCode server successfully without requiring an actual TTY.

Actual Behavior

The app fails to spawn the server because the subprocess spawner is not allocating a pseudo-terminal (PTY), causing bash to fail with "no job control" and the underlying process to fail with "not a terminal".

Workaround

Running opencode in a terminal emulator (Alacritty, Kitty, Ghostty) works perfectly. Only the desktop app fails.

Additional Context

  • The TUI version works perfectly in terminal emulators
  • This appears to be a PTY allocation issue in the Tauri process spawner
  • The OpenCode server process seems to require a TTY that isn't being provided when launched from the GUI app

justindotdevv avatar Jan 19 '26 21:01 justindotdevv

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

  • #6258: OpenCode desktop unable to run in Bazzite Linux using AppImage and RPM - similar Wayland/Linux server spawning issues
  • #6168: Open code Amd64 Linux appimage fails to launch - Linux-specific AppImage launch failures
  • #7612: AppImage Desktop fails to start with hardcoded path issues - related to CLI path resolution and spawning

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

github-actions[bot] avatar Jan 19 '26 21:01 github-actions[bot]

Image

justindotdevv avatar Jan 19 '26 21:01 justindotdevv

Having a similar, probably related issue:

Error: Failed to spawn OpenCode Server (Sidecar terminated before becoming healthy (code=Some(1) signal=None)). Logs:
2026-02-17T06:48:16.628255Z  INFO opencode_lib: Initializing app
2026-02-17T06:48:16.638179Z  INFO opencode_lib: Main and loading windows created
2026-02-17T06:48:16.638265Z  INFO opencode_lib::cli: No CLI installation found, skipping sync
2026-02-17T06:48:16.638551Z  INFO opencode_lib: Setting up server connection
2026-02-17T06:48:16.638949Z  INFO opencode_lib: Attempting server connection custom_url=None
2026-02-17T06:48:16.639523Z  INFO opencode_lib: Spawning new local server
2026-02-17T06:48:16.639534Z  INFO opencode_lib::cli: Spawning sidecar port=34753
2026-02-17T06:48:16.639760Z  INFO opencode_lib: Server connection setup
2026-02-17T06:48:16.639771Z  INFO opencode_lib: server connection started
2026-02-17T06:48:16.665228Z  INFO sidecar: opencode_lib::cli: open terminal failed: not a terminal
2026-02-17T06:48:16.741563Z  INFO sidecar: opencode_lib::cli: Sidecar terminated code=Some(1) signal=None
ge@tauri://localhost/assets/bindings-CGDisT-S.js:1:10362
@tauri://localhost/assets/bindings-CGDisT-S.js:1:3248

System Information

  • OpenCode version: 1.2.6 (both TUI and desktop)
  • Package: opencode-desktop-linux-x86_64.rpm from releases page
  • OS: Fedora Linux 43 (Workstation Edition)
  • Kernel: 6.18.9-200.fc43.x86_64
  • Desktop: GNOME 49 (Wayland compositor)

JHK avatar Feb 17 '26 06:02 JHK

During troubleshooting, I observed the following: Steps taken:

  1. Moved ~/.local/share/opencode to ~/.local/share/opencode.bak
  2. Started OpenCode - it froze during startup
  3. Removed the new ~/.local/share/opencode directory
  4. Moved ~/.local/share/opencode.bak back to ~/.local/share/opencode
  5. OpenCode now starts successfully

Logs from step 2 (frozen startup with fresh directory):

Wayland session detected; forcing native Wayland from settings
2026-02-17T07:02:12.364850Z  INFO opencode_lib: Initializing app
2026-02-17T07:02:12.375337Z  INFO opencode_lib: Main and loading windows created
2026-02-17T07:02:12.375375Z  INFO opencode_lib: Sqlite file not found, waiting for it to be generated path=/home/julian/.local/share/opencode/opencode.db
2026-02-17T07:02:12.375418Z  INFO opencode_lib: Setting up server connection
2026-02-17T07:02:12.375433Z  INFO opencode_lib::cli: No CLI installation found, skipping sync
2026-02-17T07:02:12.375902Z  INFO opencode_lib: Attempting server connection custom_url=None
2026-02-17T07:02:12.376508Z  INFO opencode_lib: Spawning new local server
2026-02-17T07:02:12.376518Z  INFO opencode_lib::cli: Spawning sidecar port=44065
2026-02-17T07:02:12.376676Z  INFO opencode_lib: Server connection setup
2026-02-17T07:02:12.376681Z  INFO opencode_lib: server connection started
2026-02-17T07:02:12.888502Z  INFO sidecar: opencode_lib::cli: Performing one time database migration, may take a few minutes...
2026-02-17T07:02:12.896375Z  INFO sidecar: opencode_lib::cli: sqlite-migration:done
2026-02-17T07:02:12.896395Z  INFO sidecar: opencode_lib::cli: Database migration complete.
2026-02-17T07:02:12.918867Z  INFO sidecar: opencode_lib::cli: opencode server listening on http://127.0.0.1:44065
2026-02-17T07:02:12.991673Z  INFO opencode_lib::server: Server ready elapsed=614.983041ms

After restoring the original directory, the app starts without issues. The cause is unclear.

Edit: The next start is broke again.

JHK avatar Feb 17 '26 07:02 JHK

I'm getting the same on macOS, actually!

Error: Failed to spawn OpenCode Server (Sidecar terminated before becoming healthy (code=Some(1) signal=None)). Logs:
2026-02-18T22:11:29.428507Z  INFO opencode_lib: Initializing app
2026-02-18T22:11:29.428539Z  INFO opencode_lib: Main and loading windows created
2026-02-18T22:11:29.428880Z  INFO opencode_lib: Setting up server connection
2026-02-18T22:11:29.430167Z  INFO opencode_lib: Attempting server connection custom_url=None
2026-02-18T22:11:29.430493Z  INFO opencode_lib: Spawning new local server
2026-02-18T22:11:29.430499Z  INFO opencode_lib::cli: Spawning sidecar port=60747
2026-02-18T22:11:29.430898Z  INFO opencode_lib: Server connection setup
2026-02-18T22:11:29.430922Z  INFO opencode_lib: server connection started
2026-02-18T22:11:29.672175Z  INFO sidecar: opencode_lib::cli: open terminal failed: not a terminal
2026-02-18T22:11:29.739369Z  INFO sidecar: opencode_lib::cli: Sidecar terminated code=Some(1) signal=None
ge@tauri://localhost/assets/bindings-CGDisT-S.js:1:10362
@tauri://localhost/assets/bindings-CGDisT-S.js:1:3248

cdbattags avatar Feb 18 '26 22:02 cdbattags

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

github-actions[bot] avatar Apr 20 '26 03:04 github-actions[bot]