claude-code - 💡(How to fix) Fix Sandbox bind-mounts /dev/null device nodes in working directory, breaking Python build tools [5 comments, 2 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#54824Fetched 2026-04-30 06:34:55
View on GitHub
Comments
5
Participants
2
Timeline
11
Reactions
0
Timeline (top)
commented ×5labeled ×4closed ×1reopened ×1

The Claude Code sandbox creates /dev/null character device node bind-mounts over common dotfile paths directly inside the working directory. These device nodes are picked up by Python build tools (hatchling, setuptools) when building sdists, and pip 26.1+ rejects the resulting tarballs because they contain special files.

Error Message

ERROR: Invalid member in the tar file ...: '.bash_profile' is a special file

Root Cause

The sandbox bind-mounts /dev/null (from devtmpfs) over these paths in the working directory:

.bash_profile, .bashrc, .profile, .zprofile, .zshrc,
.gitconfig, .gitmodules, .env, .mcp.json, .ripgreprc,
.vscode, .idea

Verified via mount | grep devtmpfs | grep "$PWD" — all 12 entries show up as devtmpfs bind mounts.

These don't exist on the actual filesystem — they're only visible inside the sandbox namespace. However, build tools like hatchling see them as real files and include them in the sdist tarball. pip 26.1's stricter tar validation (PEP 706) then rejects the tarball containing character device nodes.

Fix Action

Workaround

Running build commands (make linter, tox, etc.) from a terminal outside Claude Code works fine since the bind mounts only exist inside the sandbox.

Code Example

ERROR: Invalid member in the tar file ...: '.bash_profile' is a special file

---

.bash_profile, .bashrc, .profile, .zprofile, .zshrc,
.gitconfig, .gitmodules, .env, .mcp.json, .ripgreprc,
.vscode, .idea
RAW_BUFFERClick to expand / collapse

Summary

The Claude Code sandbox creates /dev/null character device node bind-mounts over common dotfile paths directly inside the working directory. These device nodes are picked up by Python build tools (hatchling, setuptools) when building sdists, and pip 26.1+ rejects the resulting tarballs because they contain special files.

Environment

  • Claude Code: 2.1.123
  • OS: Fedora 43 (Linux 6.19.11-200.fc43.x86_64)
  • Python: 3.12 / 3.14
  • pip: 26.1

Reproduction

  1. Open a Python project that uses hatchling (or any PEP 517 build backend) with tox
  2. Run tox or any command that builds an sdist from the project
  3. The sdist includes device nodes, and pip rejects it:
    ERROR: Invalid member in the tar file ...: '.bash_profile' is a special file

Root Cause

The sandbox bind-mounts /dev/null (from devtmpfs) over these paths in the working directory:

.bash_profile, .bashrc, .profile, .zprofile, .zshrc,
.gitconfig, .gitmodules, .env, .mcp.json, .ripgreprc,
.vscode, .idea

Verified via mount | grep devtmpfs | grep "$PWD" — all 12 entries show up as devtmpfs bind mounts.

These don't exist on the actual filesystem — they're only visible inside the sandbox namespace. However, build tools like hatchling see them as real files and include them in the sdist tarball. pip 26.1's stricter tar validation (PEP 706) then rejects the tarball containing character device nodes.

Expected Behavior

The sandbox should not create device nodes inside the working directory where they can interfere with build tools. Possible alternatives:

  • Mount them outside the project tree (e.g., in a parent or overlay namespace)
  • Use an overlay filesystem so the device nodes aren't visible to userspace tools scanning the directory
  • Add them as entries the build backend won't traverse

Workaround

Running build commands (make linter, tox, etc.) from a terminal outside Claude Code works fine since the bind mounts only exist inside the sandbox.

extent analysis

TL;DR

Run build commands outside the Claude Code sandbox to avoid device node interference.

Guidance

  • Identify the specific build tools (e.g., hatchling, setuptools) and commands (e.g., tox) that are including device nodes in the sdist tarball.
  • Verify that running these commands outside the Claude Code sandbox resolves the issue, as the bind mounts are only visible within the sandbox namespace.
  • Consider using an overlay filesystem or mounting device nodes outside the project tree to prevent interference with build tools.
  • If running outside the sandbox is not feasible, explore alternative build backends or configurations that can exclude device nodes from the sdist tarball.

Example

No code snippet is provided as the issue is related to the environment and build process rather than a specific code problem.

Notes

The provided workaround may not be suitable for all use cases, especially if the build process relies on the sandbox environment. Further investigation into alternative solutions, such as modifying the sandbox configuration or using a different build backend, may be necessary.

Recommendation

Apply workaround: Run build commands outside the Claude Code sandbox. This approach avoids the device node interference issue without requiring changes to the build tools or sandbox configuration.

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