abhigyanpatwari/GitNexus · error · SandboxError

extra read-only mount is unavailable: {source}

Error message

extra read-only mount is unavailable: {source}

What it means

Thrown by `command_prefix_for` when an `extra_read_only_mounts` source cannot be probed: `source.lstat()` or `source.resolve(strict=True)` raised `OSError`. Extra mounts are reserved for harness-owned, post-session evidence (e.g. hidden oracles) and must reference an existing, reachable source on disk.

Source

Thrown at eval/workflow_bench/proposer_sandbox.py:149

                resolved != lexical
                or stat.S_ISLNK(metadata.st_mode)
                or not (stat.S_ISDIR(metadata.st_mode) or stat.S_ISREG(metadata.st_mode))
            ):
                raise SandboxError(f"read-only sandbox path must be real and non-symlink: {raw_path}")
            additional.append(
                ReadOnlyMount(
                    source=lexical,
                    target=f"{SANDBOX_WORKSPACE}/{PurePosixPath(relative.as_posix())}",
                )
            )

        for mount in extra_read_only_mounts:
            source = mount.source.expanduser().absolute()
            try:
                metadata = source.lstat()
                resolved = source.resolve(strict=True)
            except OSError as exc:
                raise SandboxError(f"extra read-only mount is unavailable: {source}") from exc
            if (
                resolved != source
                or stat.S_ISLNK(metadata.st_mode)
                or not (stat.S_ISDIR(metadata.st_mode) or stat.S_ISREG(metadata.st_mode))
            ):
                raise SandboxError(f"extra read-only mount must be real and non-symlink: {source}")
            target = PurePosixPath(mount.target)
            if not target.is_absolute() or ".." in target.parts:
                raise SandboxError(f"extra read-only mount target must be absolute: {mount.target}")
            additional.append(ReadOnlyMount(source=source, target=target.as_posix()))

        return _sandbox_command_prefix(
            bwrap=self.bwrap_bin,
            clone=clone,
            home=self.home,
            temp=self.temp,
            claude_bin=self.claude_host_bin,
            mounts=(*self.read_only_mounts, *additional),

View on GitHub (pinned to d540b00184)

Solutions

  1. Generate the oracle/evidence file before building the prefix: ensure `source.exists()`.
  2. Verify permissions: every parent of `source` must be traversable (execute bit) so `lstat` succeeds.
  3. Pass an absolute, real path: `source=source.expanduser().resolve(strict=True)`.
  4. If the source is optional, omit it from `extra_read_only_mounts` when it is absent.

Example fix

# before: oracle not yet written
mount = ReadOnlyMount(source=Path('/run/oracle.json'), target='/workspace/oracle.json')
prefix = session.command_prefix_for(extra_read_only_mounts=[mount])  # -> SandboxError
# after: create the oracle first
Path('/run/oracle.json').write_text(json.dumps(evidence))
prefix = session.command_prefix_for(extra_read_only_mounts=[mount])
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def extra_mount_source_is_available(source: Path) -> bool:
    try:
        source.expanduser().absolute().lstat()
        source.expanduser().absolute().resolve(strict=True)
    except OSError:
        return False
    return True

mounts = [m for m in extra_mounts if extra_mount_source_is_available(m.source)]
prefix = session.command_prefix_for(extra_read_only_mounts=mounts)

Type guard

from pathlib import Path

def is_available_extra_mount_source(source: Path) -> bool:
    try:
        source.expanduser().absolute().lstat()
        source.expanduser().absolute().resolve(strict=True)
    except OSError:
        return False
    return True

Try / catch

try:
    prefix = session.command_prefix_for(extra_read_only_mounts=mounts)
except SandboxError as exc:
    if "extra read-only mount is unavailable" in str(exc):
        # generate the missing evidence file first, then retry
        write_oracle_files()
        prefix = session.command_prefix_for(extra_read_only_mounts=mounts)
    raise

Prevention

When it happens

Trigger: Calling `command_prefix_for(extra_read_only_mounts=[ReadOnlyMount(source=p, target=t)])` where `p` does not exist, has restrictive parent permissions, or sits on a broken symlink chain so `lstat`/`resolve` raise `OSError`.

Common situations: Pointing an extra mount at an oracle file that has not been generated yet; a path on an unmounted volume; parent dir with mode 000; the evidence path was cleaned up between sessions; typo in the oracle path.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/8098b714b3c65cc0. Report an issue: GitHub.