gemini-cli - 💡(How to fix) Fix bug: Gemini CLI crashes on Alpine Linux (musl libc) due to PTY resize error and relaunch IPC failure [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

1. PTY resize uncaught exception not suppressed on non-Windows platforms

On Alpine Linux, the same PTY resize race can throw an unhandled exception when a PTY session (such as the one used for executing shell commands) exits, crashing the main process. 2. Remove the process.platform === 'win32' guard on PTY resize error suppression so it applies on all platforms

Root Cause

Gemini CLI crashes on Alpine Linux when attempting to execute shell tools/commands. Two root causes were identified in packages/cli/index.ts:

Fix Action

Fixed

Code Example

if (process.platform === 'win32' && err.code === 'EIO' ...) { return; }
RAW_BUFFERClick to expand / collapse

Bug Report

Environment:

  • OS: Alpine Linux 3.21 (musl libc)
  • Node.js: v24.x
  • Gemini CLI: v0.42.0-nightly.20260507.ga809bc7c5

Describe the bug

Gemini CLI crashes on Alpine Linux when attempting to execute shell tools/commands. Two root causes were identified in packages/cli/index.ts:

1. PTY resize uncaught exception not suppressed on non-Windows platforms

The uncaughtException handler that suppresses PTY resize race-condition errors only activates on win32:

if (process.platform === 'win32' && err.code === 'EIO' ...) { return; }

On Alpine Linux, the same PTY resize race can throw an unhandled exception when a PTY session (such as the one used for executing shell commands) exits, crashing the main process.

2. Child-process relaunch via IPC fails on Alpine/musl

The CLI relaunch mechanism spawns a child with {ipc: true}. On Alpine Linux with musl libc, this IPC channel fails silently, causing issues with process lifecycle management.

Steps to reproduce

  1. Start Alpine environment: docker run --rm -it node:alpine /bin/sh
  2. Install CLI: npm install -g @google/gemini-cli@nightly
  3. Login to account
  4. Run gemini and prompt: "check my kernel version"
  5. The CLI attempts to run uname -a and crashes immediately.

Expected behavior

CLI runs normally on Alpine Linux and can successfully execute shell commands without crashing.

Proposed fix

PR #26689 fixes both issues in packages/cli/index.ts:

  1. Detect Alpine at startup (check for /etc/alpine-release) and set GEMINI_CLI_NO_RELAUNCH=true
  2. Remove the process.platform === 'win32' guard on PTY resize error suppression so it applies on all platforms

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

CLI runs normally on Alpine Linux and can successfully execute shell commands without crashing.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING