Shell snapshots have /usr/bin prepended to PATH, breaking conda

Resolved 💬 4 comments Opened Jan 30, 2026 by misha-sunborn Closed Mar 1, 2026

Description

Claude Code's shell snapshots are being created with /usr/bin prepended to the beginning of PATH, which breaks conda run and similar tools that depend on the conda environment's bin directory being found first.

Environment

  • Claude Code version: 2.1.5
  • VSCode version: 1.108.2 (Remote SSH)
  • OS: Ubuntu Linux 6.14.0-37-generic
  • Shell: bash

Steps to Reproduce

  1. Start Claude Code in VSCode
  2. Run conda run -n <env> which python3
  3. Observe it returns /usr/bin/python3 instead of the conda environment's Python

Expected Behavior

conda run -n wrf which python3 should return /home/user/miniforge3/envs/wrf/bin/python3

Actual Behavior

Returns /usr/bin/python3 because PATH in the shell snapshot starts with /usr/bin:... instead of the normal PATH order.

Root Cause

Shell snapshots in ~/.claude/shell-snapshots/ are being created with /usr/bin at the front of PATH:

export PATH=/usr/bin\:/home/user/.vscode-server/cli/servers/...

Instead of the correct order:

export PATH=/home/user/.vscode-server/cli/servers/...:/usr/local/bin:/usr/bin:...

Workaround

Add this to .bashrc:

# Fix Claude Code PATH bug
if [[ "$PATH" == /usr/bin:* ]]; then
    export PATH="${PATH#/usr/bin:}"
fi

Or manually fix snapshots:

sed -i 's|^export PATH=/usr/bin\\:|export PATH=|' ~/.claude/shell-snapshots/*.sh

Additional Context

  • Issue started around Jan 28, 2026, after VSCode updated to 1.108.2 on Jan 26
  • The VSCode node process has a correct PATH; the corruption happens during Claude Code's shell spawning/snapshot creation
  • Older snapshots (before Jan 28) have correct PATH ordering

View original on GitHub ↗

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