abhigyanpatwari/GitNexus · error · OSError
short write while staging oracle
Error message
short write while staging oracle
What it means
The only OSError in this set, raised inside _write_stage_file when os.write() returns <= 0 during the staged write loop. Writes to a regular file should never return 0; a non-positive return indicates a filesystem-level failure (ENOSPC, EIO, quota, or a full tmpfs/NFS write boundary).
Source
Thrown at eval/workflow_bench/oracle_assets.py:482
destination.parent.mkdir(parents=True, mode=0o700, exist_ok=True)
current = stage_root
for part in PurePosixPath(item.target).parts[:-1]:
current /= part
metadata = current.lstat()
if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):
raise ValueError(f"oracle stage parent must be a real directory: {item.target}")
current.chmod(0o700)
descriptor = os.open(
destination,
os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_NOFOLLOW", 0),
0o400,
)
try:
view = memoryview(item.payload)
while view:
written = os.write(descriptor, view)
if written <= 0:
raise OSError("short write while staging oracle")
view = view[written:]
os.fchmod(descriptor, 0o400)
os.fsync(descriptor)
finally:
os.close(descriptor)
def _verify_staged_oracle(stage_root: Path, snapshot: TaskOracleSnapshot) -> None:
root_metadata = stage_root.lstat()
if stat.S_ISLNK(root_metadata.st_mode) or not stat.S_ISDIR(root_metadata.st_mode):
raise ValueError("oracle stage root changed during verification")
for item in snapshot.files:
relative = PurePosixPath(item.target)
current = stage_root
for part in relative.parts[:-1]:
current /= part
metadata = current.lstat()
if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):View on GitHub (pinned to d540b00184)
Solutions
- Check free space and quota: `df -h <worktree>` and `quota -s` (if applicable).
- Point the worktree at a local filesystem with headroom >= MAX_ORACLE_TOTAL_BYTES.
- Ensure the stage root is a real directory and the file is a regular file (see [358]) before writing.
- Retry staging on a clean FS after freeing space; if it recurs, treat the FS as unhealthy.
Defensive patterns
Strategy: try-catch
Validate before calling
import os, shutil
from pathlib import Path
from eval.workflow_bench.oracle_assets import MAX_ORACLE_TOTAL_BYTES
def stage_has_headroom(worktree: Path) -> bool:
usage = shutil.disk_usage(worktree)
return usage.free >= MAX_ORACLE_TOTAL_BYTES
Type guard
def is_oracle_short_write(exc: BaseException) -> bool:
return isinstance(exc, OSError) and "short write" in str(exc)
Try / catch
try:
with oracle_assets.staged_task_oracle(worktree, snapshot) as root:
run_command(root)
except OSError as exc:
raise AbortTask(f"oracle staging I/O failed: {exc}") from exc
Prevention
- Provision >= MAX_ORACLE_TOTAL_BYTES (2 MiB) plus margin on the staging volume.
- Use a local non-special filesystem for the worktree, not a pipe/special device.
When it happens
Trigger: Triggered when os.write(descriptor, view) returns 0 or negative while staging oracle bytes into .wfbench-oracle-<hex>/<target> — disk full, quota exceeded, NFS/overlayfs write error, or the staging FS was a pipe/special file substituted via a race.
Common situations: Out-of-disk on the worktree volume; a small tmpfs used for staging; a quota limit hit mid-write; overlayfs ENOSPC; a model process racing to replace the file with a pipe.
Related errors
- oracle stage parent must be a real directory: {item.target}
- short write while staging candidate overlay
- oracle root is unavailable: {lexical}
- oracle root must be a real non-symlink directory: {lexical}
- oracle parent is unreadable: {relative}
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/f4653c41c9e8a64d.
Report an issue: GitHub.