Verbose `which` errors on NixOS at startup

Resolved 💬 2 comments Opened Feb 10, 2026 by pfassina Closed Mar 11, 2026

Description

On NixOS, starting Claude Code prints noisy which errors to the terminal:

which: no code in (/nix/store/...-procps-4.0.4/bin:...)
which: no vi in (/nix/store/...-procps-4.0.4/bin:...)

This happens because NixOS ships GNU which, which prints verbose error messages to stdout/stderr when a binary isn't found. On most other distros, which fails silently (exit code 1, no output).

Claude Code probes for editors (code, vi) at startup using which, and the output leaks to the user's terminal.

Impact

  • Cosmetic but noticeable — the errors appear every time Claude Code starts
  • Affects all NixOS users who don't have VS Code and/or vi installed
  • Particularly common on NixOS because users often have nvim but not vi (neovim doesn't create a vi symlink by default), and many NixOS users use terminal-based workflows without VS Code

Suggested fixes

  1. Redirect stderr/stdout when running which — e.g. which code >/dev/null 2>&1 instead of which code
  2. Use command -v instead of whichcommand -v is POSIX, built into all shells, and always fails silently. It's generally the recommended approach over which

Either change would fix this on NixOS and also be more robust on other platforms.

Environment

  • NixOS (nixos-unstable)
  • Claude Code installed via nixpkgs claude-code package
  • Shell: Nushell (but the issue is in Claude Code's subprocess, not the user's shell)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗