[GH-ISSUE #24] Windows: PreToolUse Task hook error - $CLAUDE_PROJECT_DIR not resolved (literal path error) #20

Closed
opened 2026-03-03 15:47:15 +03:00 by kerem · 3 comments
Owner

Originally created by @flyGetHu on GitHub (Feb 3, 2026).
Original GitHub issue: https://github.com/mindfold-ai/Trellis/issues/24

Description
When using Claude's toolchain/hooks on Windows system, the PreToolUse:Task hook error is thrown because the environment variable $CLAUDE_PROJECT_DIR is not parsed and is treated as a literal string in the file path. This causes the Python interpreter to fail to find the inject-subagent-context.py file, as the path is incorrectly spliced with the unparsed variable name.

 Error: PreToolUse:Task hook error: [python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/inject-subagent-context.py"]: C:\Users\97078\scoop\apps\python\current\python.exe: can't open file
'C:\Users\97078\workspace\java\anjun-customs-project\$CLAUDE_PROJECT_DIR\.claude\hooks\inject-subagent-context.py': [Errno 2] No such file or directory

Originally created by @flyGetHu on GitHub (Feb 3, 2026). Original GitHub issue: https://github.com/mindfold-ai/Trellis/issues/24 Description When using Claude's toolchain/hooks on Windows system, the PreToolUse:Task hook error is thrown because the environment variable $CLAUDE_PROJECT_DIR is not parsed and is treated as a literal string in the file path. This causes the Python interpreter to fail to find the inject-subagent-context.py file, as the path is incorrectly spliced with the unparsed variable name.  Error: PreToolUse:Task hook error: [python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/inject-subagent-context.py"]: C:\Users\97078\scoop\apps\python\current\python.exe: can't open file 'C:\\Users\\97078\\workspace\\java\\anjun-customs-project\\$CLAUDE_PROJECT_DIR\\.claude\\hooks\\inject-subagent-context.py': [Errno 2] No such file or directory
kerem closed this issue 2026-03-03 15:47:15 +03:00
Author
Owner

@taosu0216 commented on GitHub (Feb 3, 2026):

what is your trellis version, you can check it with tl -v

<!-- gh-comment-id:3838497016 --> @taosu0216 commented on GitHub (Feb 3, 2026): what is your trellis version, you can check it with tl -v
Author
Owner

@taosu0216 commented on GitHub (Feb 3, 2026):

We removed the environment variable in version v0.3.0-beta.7 and used relative paths to solve this issue instead.

<!-- gh-comment-id:3838572730 --> @taosu0216 commented on GitHub (Feb 3, 2026): We removed the environment variable in version v0.3.0-beta.7 and used relative paths to solve this issue instead.
Author
Owner

@flyGetHu commented on GitHub (Feb 3, 2026):

❯ trellis.cmd -v
0.2.11

try update last version

<!-- gh-comment-id:3839193848 --> @flyGetHu commented on GitHub (Feb 3, 2026): ❯ trellis.cmd -v 0.2.11 try update last version
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Trellis#20
No description provided.