claude-code - 💡(How to fix) Fix [BUG] WSL2 Sandbox bwrap fails to mount ~/.aws when symlinked to inaccessible path [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#45122Fetched 2026-04-09 08:12:44
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

Error Message

Error: Exit code 1 bwrap: Can't mount tmpfs on /newroot/home/user/.aws: No such file or directory

Fix Action

Workaround

Deactivate sandbox which defeats security measures.

Code Example

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": [
      "Bash"
    ],
    "deny": [
      "Read(~/.ssh/**)",
      "Read(~/.gnupg/**)",
      "Read(~/.aws/**)",
      "Read(/mnt/**)",
      "Edit(~/.ssh/**)",
      "Edit(~/.gnupg/**)",
      "Edit(~/.aws/**)",
      "Edit(/mnt/**)"
    ]
  },
  "sandbox": {
    "enabled": true,
    "failIfUnavailable": true,
    "filesystem": {
      "allowWrite": [
        "~/allowed",
        "/tmp"
      ],
      "denyRead": [
        "~/.ssh",
        "~/.gnupg",
        "~/.aws"
      ]
    }
  },
  "additionalDirectories": [
    "/home/user/allowed"
  ]
}

---

Error: Exit code 1
     bwrap: Can't mount tmpfs on /newroot/home/user/.aws: No such file or
     directory

---
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

Claude code's sandbox tries to mount a symlink that points to a directory that is already forbidden.

Steps to reproduce

  1. ~/.claude/settings.json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": [
      "Bash"
    ],
    "deny": [
      "Read(~/.ssh/**)",
      "Read(~/.gnupg/**)",
      "Read(~/.aws/**)",
      "Read(/mnt/**)",
      "Edit(~/.ssh/**)",
      "Edit(~/.gnupg/**)",
      "Edit(~/.aws/**)",
      "Edit(/mnt/**)"
    ]
  },
  "sandbox": {
    "enabled": true,
    "failIfUnavailable": true,
    "filesystem": {
      "allowWrite": [
        "~/allowed",
        "/tmp"
      ],
      "denyRead": [
        "~/.ssh",
        "~/.gnupg",
        "~/.aws"
      ]
    }
  },
  "additionalDirectories": [
    "/home/user/allowed"
  ]
}
  1. Create a symlink to Windows file system: mkdir -p /mnt/c/Users/me/.aws ; ln -s /mnt/c/Users/me/.aws $HOME/.aws. Replace me with your windows username.
  2. Ensure that sandbox is enabled.
  3. Have claude code execute any bash command, e.g. Please list directory content of ~/allowed.

Expected result

Directory is listed.

Actual result

Error: Exit code 1
     bwrap: Can't mount tmpfs on /newroot/home/user/.aws: No such file or
     directory

You cannot get around that. The symlink is intentional and must be retained.

Worse!

If I remove the "~/.aws" line from settings.json and restart claude code, it still fails with the same error!

It looks like Claude Code caches the old configuration and retains it, ignoring more recent changes to the sandbox configuration.

Workaround

Deactivate sandbox which defeats security measures.

What Should Happen?

see above

Error Messages/Logs

Steps to Reproduce

see above

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.96

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

No response

extent analysis

TL;DR

  • The issue can be mitigated by properly handling the symlink in the sandbox configuration or by restarting the service after updating the configuration to ensure the changes are applied.

Guidance

  • Verify that the settings.json file is correctly formatted and that the denyRead section does not include the symlinked directory.
  • Check if there's an option to refresh or reload the configuration without restarting the entire service, to avoid caching issues.
  • Consider adding an exception for the specific symlink in the sandbox configuration, if possible.
  • If the issue persists, try to manually remove any cached configuration files or restart the service to ensure the latest configuration is applied.

Example

  • No specific code example is provided as the issue seems to be related to configuration and caching rather than code implementation.

Notes

  • The provided workaround of deactivating the sandbox is not recommended as it defeats security measures.
  • The issue might be related to how the sandbox handles symlinks and cached configurations, which could be specific to the Claude Code version or the WSL environment.

Recommendation

  • Apply workaround: Properly handle the symlink in the sandbox configuration or restart the service after updating the configuration.
  • Reason: This approach addresses the caching issue and ensures the latest configuration is applied without compromising security measures.

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] WSL2 Sandbox bwrap fails to mount ~/.aws when symlinked to inaccessible path [1 participants]