agentscope-ai/agentscope · error · RuntimeError
Bubblewrap read_file failed
Error message
Bubblewrap read_file failed (exit {result.exit_code}): {result.stderr.decode(errors='replace')} What it means
A catch-all RuntimeError from read_file when the sandboxed cat command fails with an unexpected exit code. The message embeds the exit code and the sandboxed command's stderr, which is the primary diagnostic.
Solutions
- Read the embedded stderr in the exception message to identify the underlying cause
- Verify bwrap works standalone (bwrap --ro-bind / / echo ok)
- Check file permissions and mount health inside the sandbox
- If bwrap setup fails, re-provision the workspace
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try:
data = await ws.read_file(p)
except RuntimeError as e:
log.error('sandbox read failed: %s', e) # stderr is embedded Prevention
- Monitor embedded stderr to distinguish bwrap breakage from app errors
- Smoke-test bwrap after environment changes
When it happens
Trigger: Any failure of the inner `sh -c cat` that is neither exit 66 (not found) nor 65 (outside writable mounts): e.g. permission bits on the file inside the sandbox, I/O errors, or bwrap itself failing to launch.
Common situations: Read-only or corrupted mounts inside the sandbox, a broken bwrap installation, or disk errors. Inspect result.stderr embedded in the message.
Related errors
- Bubblewrap write failed
- host_cache_dir must not be a symbolic link.
- host_workdir must be a directory.
- must not overlap .
- not found in Bubblewrap sandbox
AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28).
Data as JSON: /api/errors/bca7f09f482d8b53.
Report an issue: GitHub.
Appendix: source
Thrown at src/agentscope/workspace/_bubblewrap/_bubblewrap_backend.py:276
'resolved=$(realpath -e -- "$1") || exit 66; '
'case "$resolved" in '
"/workspace|/workspace/*|/tmp|/tmp/*) "
'cat -- "$resolved" ;; '
"*) exit 65 ;; "
"esac"
),
"sh",
sandbox_path,
],
)
if result.exit_code == 66:
raise FileNotFoundError(f"not found in Bubblewrap sandbox: {path}")
if result.exit_code == 65:
raise PermissionError(
f"path escapes writable Bubblewrap mounts: {path}",
)
if not result.ok():
raise RuntimeError(
"Bubblewrap read_file failed "
f"(exit {result.exit_code}): "
f"{result.stderr.decode(errors='replace')}",
)
return result.stdout
async def write_file(self, path: str, data: bytes) -> None:
"""Write raw bytes, refusing every symbolic-link final component."""
await self._write_via_cat(path, data)
async def write_stream(
self,
path: str,
stream: AsyncIterator[bytes],
) -> None:
"""Stream bytes into ``path``, chunk by chunk through ``cat``."""
await self._write_via_cat(path, stream)
View on GitHub (pinned to e90f1c7592)