claude-code - 💡(How to fix) Fix [BUG] Project-local symlink to allowed external directory is still unusable [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51960Fetched 2026-04-23 07:40:19
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×5

Root Cause

This seems distinct from the existing issues because it is specifically:

Code Example

/Users/<me>/Documents/Projects/example/.gsd -> /Users/<me>/.gsd/projects/test123

---

mkdir -p /Users/<me>/Documents/Projects/example
   mkdir -p /Users/<me>/.gsd/projects/test123
   echo "hello" > /Users/<me>/.gsd/projects/test123/test.txt

---

ln -s /Users/<me>/.gsd/projects/test123 /Users/<me>/Documents/Projects/example/.gsd
   cd /Users/<me>/Documents/Projects/example

---

ls -la .gsd
RAW_BUFFERClick to expand / collapse

Bug Description

Claude Code cannot reliably use a project subdirectory that is a symlink to a directory outside the project root, even when the target path is explicitly allowed via permissions.additionalDirectories or --add-dir.

Example layout:

/Users/<me>/Documents/Projects/example/.gsd -> /Users/<me>/.gsd/projects/test123

The symlink is valid and works in the shell, but Claude Code still fails to use the symlinked path for normal agent work.

This appears to be the intersection of:

  • #764 (symlink traversal failure)
  • #29013 (additionalDirectories does not grant actual access)

Steps to Reproduce

  1. Create a project and an external directory:

    mkdir -p /Users/<me>/Documents/Projects/example
    mkdir -p /Users/<me>/.gsd/projects/test123
    echo "hello" > /Users/<me>/.gsd/projects/test123/test.txt
  2. Symlink a project-local subdirectory to the external directory:

    ln -s /Users/<me>/.gsd/projects/test123 /Users/<me>/Documents/Projects/example/.gsd
    cd /Users/<me>/Documents/Projects/example
  3. Confirm the symlink works normally:

    ls -la .gsd
  4. Allow the external target path using either:

    • permissions.additionalDirectories, or
    • claude --add-dir /Users/<me>/.gsd/projects/test123
  5. Ask Claude Code to read or operate on .gsd/test.txt (or otherwise use .gsd/ normally).

Expected Behavior

If the real target path is explicitly allowed, Claude Code should be able to traverse the project-local symlink and use files under .gsd/ normally.

Actual Behavior

The symlinked path remains unusable for agent work even though:

  • the symlink is valid
  • the target exists
  • the target works in the shell
  • the target path is explicitly allowed

Environment

  • macOS
  • Claude Code current as of 2026-04-22

Notes

This seems distinct from the existing issues because it is specifically:

  • a symlink inside the project
  • pointing to a directory outside cwd
  • where explicitly allowing the real target still does not make the project-local symlink usable

extent analysis

TL;DR

The issue can be mitigated by using the --add-dir flag with the absolute path of the symlink target, ensuring Claude Code has explicit access to the target directory.

Guidance

  • Verify that the permissions.additionalDirectories configuration or the --add-dir flag is correctly set to the absolute path of the target directory (/Users/<me>/.gsd/projects/test123).
  • Check if the issue persists when using the absolute path of the symlink target instead of the symlink itself.
  • Consider testing with a different project layout to isolate if the issue is specific to the current directory structure.
  • Ensure that the Claude Code version being used is up-to-date, as the issue might be related to existing bugs (#764, #29013) that could have been addressed in later versions.

Example

No code snippet is provided as the issue seems to be related to configuration and directory structure rather than code.

Notes

The solution might not be applicable if the issue is indeed a bug in Claude Code that hasn't been fixed yet. The provided steps are based on the information given and might need adjustments based on the actual Claude Code version and configuration being used.

Recommendation

Apply the workaround by using the --add-dir flag with the absolute path of the symlink target, as this seems to be the most direct way to ensure Claude Code has access to the target directory.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Project-local symlink to allowed external directory is still unusable [1 participants]