Background job sessions on Windows get a broken/minimal PATH (literal unexpanded $PATH token)

Open 💬 0 comments Opened Jul 2, 2026 by BenMendel

Description

In a background-job Claude Code session on Windows, the PATH environment variable inherited by tool-invoked shells (both the PowerShell tool and the Bash/Git-Bash tool) is a minimal, apparently-broken value rather than the user's normal Windows PATH.

Running in a PowerShell tool call within the session:

$env:PATH -split ';'

returned:

C:\Program Files\PowerShell\7
C:\Users\User\.local\bin
$PATH

Notes:

  • There is no C:\Windows\System32, no dotnet install dir, no other normal Windows PATH entries — just PowerShell 7's own folder and .local\bin.
  • The literal string $PATH appears unexpanded in the value. This looks like an env-var template (e.g. something like PATH=$PATH:/extra/dir, which is bash/POSIX syntax) that was meant to be interpolated but wasn't, before being passed into the Windows process's environment.
  • As a result, common tools that are on the user's real PATH (dotnet, gh, etc.) are not found by either the PowerShell tool or the Bash tool in this session, even though they work fine in the user's normal interactive terminal.
  • This was observed specifically in a background job session on Windows; it's unconfirmed whether it also reproduces in foreground/interactive sessions.

Steps to reproduce

  1. Start a Claude Code background job/session on Windows.
  2. In the PowerShell tool, run $env:PATH -split ';' (or Get-Command dotnet).
  3. Observe that PATH is truncated to C:\Program Files\PowerShell\7, C:\Users\User\.local\bin, and a literal, unexpanded $PATH token — and that tools present on the user's real PATH (e.g. dotnet) are not found.

Expected behavior

Tool-invoked shells (PowerShell and Bash) in a Claude Code session should inherit (or correctly reconstruct) the user's actual PATH, so that locally installed CLI tools are discoverable without needing to resolve full binary paths manually.

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Shell: PowerShell 7.6.3 (pwsh), invoked non-interactively by the Claude Code PowerShell tool; also reproduced via the Bash tool (Git Bash)
  • Session type: background job

View original on GitHub ↗