chenhg5/cc-connect · error
geminiSession: start: %w
Error message
geminiSession: start: %w
What it means
After wiring stdin/stdout/stderr, Send calls cmd.Start() to launch the gemini CLI; failure is wrapped as `geminiSession: start: %w`. Unlike New()'s LookPath check, this fires when the binary was found but could not actually be executed.
Source
Thrown at agent/gemini/session.go:194
cmd.WaitDelay = 1 * time.Second
cmd.Dir = gs.workDir
env := os.Environ()
if len(gs.extraEnv) > 0 {
env = core.MergeEnv(env, gs.extraEnv)
}
cmd.Env = env
cmd.Stdin = strings.NewReader(fullPrompt)
stdout, err := cmd.StdoutPipe()
if err != nil {
return fmt.Errorf("geminiSession: stdout pipe: %w", err)
}
var stderrBuf bytes.Buffer
cmd.Stderr = &stderrBuf
if err := cmd.Start(); err != nil {
return fmt.Errorf("geminiSession: start: %w", err)
}
started = true
gs.wg.Add(1)
go func() {
defer cancel()
gs.readLoop(ctx, cmd, stdout, &stderrBuf, append(imageRefs, fileRefs...))
}()
return nil
}
func (gs *geminiSession) readLoop(ctx context.Context, cmd *exec.Cmd, stdout io.ReadCloser, stderrBuf *bytes.Buffer, tempImages []string) {
defer gs.wg.Done()
defer func() {
// Clean up temp image files
for _, f := range tempImages {
os.Remove(f)View on GitHub (pinned to 4000b2338a)
Solutions
- Run the wrapped inner error down: test `gemini --version` as the same user
- Reinstall the CLI (`npm i -g @google/gemini-cli`) if the binary is corrupt or arch-mismatched
- Fix shebang/interpreter issues (ensure `node` is on PATH for the shim script)
- Check mount flags (noexec) and process/fork limits if the errno is EACCES/EAGAIN
Example fix
// before $ file $(which gemini) gemini: ELF 64-bit ... (aarch64) # on x86_64 host // after $ npm i -g @google/gemini-cli $ gemini --version
Defensive patterns
Strategy: try-catch
Validate before calling
// deeper than LookPath: verify the binary actually executes
out, err := exec.Command("gemini", "--version").CombinedOutput()
if err != nil { return fmt.Errorf("gemini CLI broken (%v): %s", err, out) } Try / catch
if err := sess.Send(prompt, id, nil, nil); err != nil && strings.Contains(err.Error(), "start:") {
var ee *exec.Error
if errors.As(err, &ee) { log.Printf("exec failed for %q: %v", ee.Name, ee.Err) }
} Prevention
- Pin and verify the CLI version at daemon startup (doctor check)
- Avoid version-manager shims on the daemon's PATH; use absolute node/npm paths
- Ensure mounts hosting the binary are not noexec and match the host architecture
When it happens
Trigger: cmd.Start() returns an error: binary removed from PATH after construction, exec format error (wrong architecture/corrupt install), missing interpreter shebang, noexec mount, or fork/exec resource limits.
Common situations: nvm/version-manager switched node versions so the gemini shim is broken; npm global update replaced the binary mid-flight; binary installed for another OS/arch; /usr mounted noexec; EAGAIN from fork limits under heavy load.
Related errors
- antigravitySession: start: %w
- %s
- codex app-server exited: %w
- copilot probe: start: %w
- copilotSession: stdin pipe: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/d12c9cdabaa72faf.
Report an issue: GitHub.