claude-code - 💡(How to fix) Fix [Bug] virtiofs mount serves truncated file contents to sandboxed environment while host files are clean [2 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#50873Fetched 2026-04-20 12:10:42
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
labeled ×6commented ×2

Error Message

Error message:

Fix Action

Fix / Workaround

Workaround: always run publish/build commands from the host terminal, not from Claude inside Cowork, until this is resolved. Restarting the Cowork session may re-sync the mount, but I didn't get to verify.

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description Summary: Cowork's virtiofs mount served stale/truncated file contents to the sandboxed Linux environment while the host Windows disk was clean. Git-level tools inside the sandbox reported the working tree as modified, files ended mid-statement, and python -m py_compile raised SyntaxError — all on files that were verified clean and matching HEAD from the host's PowerShell. Repro:

On Windows, place a git repo with ~1000-line Python files in a user folder (e.g., C:\Users<you>\Documents<repo>). Select that folder in Cowork; Cowork mounts it at /sessions/<id>/mnt/<name> via virtiofs. In the sandbox, run against a specific file:

wc -c <file> — reports a byte count smaller than the host's. git hash-object <file> — returns a SHA different from git ls-tree HEAD <file>. git diff HEAD -- <file> — shows large deletions that don't exist on the host. python -m py_compile <file> — fails with SyntaxError at the truncation boundary.

In host PowerShell, the same commands report the file as clean, hash matches HEAD, compiles cleanly.

Key detail that made the bug hard to diagnose: the .git/index mtime did reflect live host activity inside the sandbox — so a standard "is the mount stale?" check passed. The staleness was selective to specific working-tree files, not the whole mount. This allowed two Claude sessions with different views of the same path to argue past each other across multiple rounds. Impact: If a user asks Claude inside Cowork to run a build/publish command (twine upload, npm publish, docker build) against a folder with this discrepancy, Claude would package the corrupted sandbox view and ship it to a public registry. This nearly happened on the cloakllm v0.6.3 release. Error message: $ python3 -m py_compile server.py File "server.py", line 731 """ ^ SyntaxError: unterminated triple-quoted string literal (detected at line 735) EXIT=1 (file on host disk was 38,869 bytes, ended cleanly with if name == "main": mcp.run(); sandbox view was 30,917 bytes, truncated mid-docstring) Environment:

Windows host: [put your Windows version here] Mounted path: C:\Users\97250\Documents\cloakllm Sandbox path: C:\Users\97250\Documents\cloakllm Filesystem: virtiofs via fuse Claude desktop app version: [from Help → About or equivalent] Session type: Cowork mode

Workaround: always run publish/build commands from the host terminal, not from Claude inside Cowork, until this is resolved. Restarting the Cowork session may re-sync the mount, but I didn't get to verify.

Environment Info

  • Platform: win32
  • Terminal: vscode
  • Version: 2.1.110
  • Feedback ID: bf22aca8-f73d-40b4-8b13-05300c956cb8

Errors

[]

extent analysis

TL;DR

The issue can be mitigated by running publish/build commands from the host terminal instead of from Claude inside Cowork until the virtiofs mount staleness issue is resolved.

Guidance

  • Verify that the issue is specific to virtiofs mounts by checking if the problem persists with a different mount type.
  • Check the documentation for virtiofs and fuse to see if there are any known issues or configuration options that could resolve the staleness issue.
  • Consider implementing a periodic sync or refresh of the mount to ensure that the sandbox environment has an up-to-date view of the host files.
  • Investigate if there are any specific file types or sizes that are more prone to this issue, which could help narrow down the root cause.

Example

No code snippet is provided as the issue seems to be related to the virtiofs mount and fuse configuration rather than a specific code problem.

Notes

The issue seems to be specific to the virtiofs mount and the interaction between the host Windows environment and the sandboxed Linux environment. The fact that the .git/index mtime reflects live host activity inside the sandbox, but specific working-tree files are stale, suggests a complex issue that may require a deeper understanding of the virtiofs and fuse configuration.

Recommendation

Apply workaround: Run publish/build commands from the host terminal until the virtiofs mount staleness issue is resolved, as this has been shown to produce the correct results and avoids the risk of packaging corrupted files.

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] virtiofs mount serves truncated file contents to sandboxed environment while host files are clean [2 comments, 2 participants]