[BUG] path.relative() computed from bash.cwd instead of CLI startup directory causing edition of Plans and local files to fail

Resolved 💬 3 comments Opened Mar 17, 2026 by Shiranuit Closed Apr 20, 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?

The existence of custom skills or rules containing paths pattern causes Claude Code to reject operations on plans because the path is computed relative to the current CWD, same for local changes but this time after having changed the CWD by running a cd prior to the Read/Write/Edit operation in a subfolder causing the following errors.

Error: path should be a `path.relative()`d string, but got "../README.md"
Updated plan
  ⎿  Error: path should be a `path.relative()`d string, but got "../../.claude/plans/silly-stirring-floyd.md"

Chain of events local file edition

  1. Claude Code starts in /project/skill-with-path/ which contains custom skills having have paths pattern specified
  2. It runs cd ./lorem-ipsum && npm run lorem-ipsum 3, which changes the bash CWD to /project/skill-with-path/lorem-ipsum/.
  3. It then tries to edit /project/skill-with-path/README.md.
  4. Internally, it computes path.relative(bash.cwd, filePath), which yields ../README.md.
  5. A validation check (via node-ignore) rejects paths that start with .., so the edit fails.

Chain of events for plan edition

  1. Claude Code starts in /project/skill-with-path/ which contains custom skills having have paths pattern specified
  2. It then tries to edit ~/.claude/plans/silly-stirring-floyd.md.
  3. Internally, it computes path.relative(bash.cwd, filePath), which yields ../../home/user/.claude/plans/silly-stirring-floyd.md.
  4. A validation check (via node-ignore) rejects paths that start with .., so the edit fails.

What Should Happen?

Relative path should probably be computed in regard to the directory where Claude Code's CLI was started in the first place rather than the current bash cwd, and the behaviour should not depend on the existence or not of custom skills / rules containing paths patterns.
As for plans the "$HOME/.claude/plans" should probably be used to test where the Read/Write/Edit operation is relative to the plans folder or CLI starting folder, if both are escaping with .. then it should be rejected

Error Messages/Logs

Error: path should be a `path.relative()`d string, but got "../README.md"
Updated plan
  ⎿  Error: path should be a `path.relative()`d string, but got "../../.claude/plans/silly-stirring-floyd.md"

Steps to Reproduce

I created the following repository which allows reproducing the bug quite reliably, it contains instruction on how to reproduce with different prompts and scenarios https://github.com/maleus-ai/claude-code-relative-path-bug/

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.77 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux (WSL)
Ubuntu/Debian Linux
MacOS

Terminal/Shell

WSL (Windows Subsystem for Linux)
XTerm
Terminal.app (MacOS)

Additional Information

_No response_

View original on GitHub ↗

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