[BUG] Hook paths broken on Windows in v2.1.47 — backslashes stripped, CWD prepended

Resolved 💬 3 comments Opened Feb 19, 2026 by bharat2288 Closed Feb 22, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Hooks that worked correctly in v2.1.45 are completely broken in v2.1.47 on Windows. Claude Code strips all backslash path separators from the hook command and concatenates path segments into a single string, then prepends the current working directory.

Hook configuration:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "type": "command",
        "command": "python C:\\Users\\bhara\\dev\\claude-workflow-system\\hooks\\log-prompt.py"
      }
    ]
  }
}

This affects all hook types — UserPromptSubmit, SessionEnd, etc.

What Should Happen?

Hook should execute python with the absolute path as specified:
C:\Users\bhara\dev\claude-workflow-system\hooks\log-prompt.py

Instead, Claude Code resolves the path to:
C:\Users\bhara\dev\moom-order-forecasting\Usersbharadevclaude-workflow-systemhookslog-prompt.py

The backslashes are stripped, all segments are concatenated into one string, and the CWD (moom-order-forecasting) is prepended. This causes [Errno 2] No such file or directory and blocks the operation entirely.

Error Messages/Logs

● UserPromptSubmit operation blocked by hook:
  [python C:\Users\bhara\dev\claude-workflow-system\hooks\log-prompt.py]: C:\Program
  Files\Python311\python.exe: can't open file 'C:\\Users\\bhara\\dev\\moom-order-forecast
  ing\\Usersbharadevclaude-workflow-systemhookslog-prompt.py': [Errno 2] No such file or

● UserPromptSubmit operation blocked by hook:
  [python C:\Users\bhara\dev\claude-workflow-system\hooks\screenshot-inject.py]:
  C:\Program Files\Python311\python.exe: can't open file 'C:\\Users\\bhara\\dev\\moom-ord
  er-forecasting\\Usersbharadevclaude-workflow-systemhooksscreenshot-inject.py': [Errno
  2] No such file or directory

SessionEnd hook [python C:\Users\bhara\dev\claude-workflow-system\hooks\session-end.py] failed: C:\Program Files\Python311\python.exe: can't open file 'C:\\Users\\bhara\\dev\\moom-order-forecasting\\Usersbharadevclaude-workflow-systemhookssession-end.py': [Errno 2] No such file or directory

Steps to Reproduce

  1. On Windows, configure any hook with an absolute path using backslashes in .claude/settings.json
  2. Run claude from any project directory
  3. Type any prompt or trigger the hook
  4. Hook fails with mangled path — backslashes stripped, segments concatenated, CWD prepended

Workaround: Roll back to v2.1.45:
npm install -g @anthropic-ai/claude-code@2.1.45

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.45

Claude Code Version

2.1.47

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

This is a regression between v2.1.45 → v2.1.47. Likely a change to how hook commands are parsed/split that doesn't account for Windows backslash path separators. The path mangling pattern (strip separators + concatenate + prepend CWD) is consistent across all three affected hooks.

View original on GitHub ↗

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