{"record":{"id":"6d9122d591b613a3","repo":"abhigyanpatwari/GitNexus","slug":"short-write-while-neutralizing-name","errorCode":null,"errorMessage":"short write while neutralizing {name}","messagePattern":"short write while neutralizing (.+?)","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/sanitized_graph.py","lineNumber":126,"sourceCode":"    try:\n        metadata = path.lstat()\n    except FileNotFoundError:\n        metadata = None\n    if metadata is not None:\n        if stat.S_ISDIR(metadata.st_mode):\n            raise SandboxError(f\"target-controlled {name} must not be a directory\")\n        path.unlink()\n    descriptor = os.open(\n        path,\n        os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, \"O_NOFOLLOW\", 0),\n        0o600,\n    )\n    try:\n        view = memoryview(payload)\n        while view:\n            written = os.write(descriptor, view)\n            if written <= 0:\n                raise OSError(f\"short write while neutralizing {name}\")\n            view = view[written:]\n        os.fsync(descriptor)\n    finally:\n        os.close(descriptor)\n\n\ndef _neutralize_target_index_inputs(root: Path) -> None:\n    index = root / \".gitnexus\"\n    try:\n        metadata = index.lstat()\n    except FileNotFoundError:\n        metadata = None\n    if metadata is not None:\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):\n            raise SandboxError(\"target .gitnexus path must be a real directory before graph preparation\")\n        shutil.rmtree(index)\n    _replace_control_file(root, \".gitnexusrc\", b\"{}\\n\")\n    _replace_control_file(root, \".gitnexusignore\", b\"\")","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/sanitized_graph.py#L108-L144","documentation":"Write-failure guard in _replace_control_file. While overwriting .gitnexusrc or .gitnexusignore, os.write is called in a loop; if it returns zero or negative (no progress), the harness raises OSError('short write while neutralizing <name>'). Note this is raised as OSError, not SandboxError, and propagates out of the neutralization step. The message names which control file failed.","triggerScenarios":"os.write returns <= 0 on a descriptor that is open for writing to a regular file. Real causes: the underlying filesystem is full (ENOSPC), the disk hit I/O errors (EIO), the FS was remounted read-only mid-write, or a quota was exceeded.","commonSituations":"Benchmark runs on a small tmpfs that filled up; a CI runner with a low disk quota; a flaky networked filesystem; the workspace disk hit an I/O error.","solutions":["Free disk space on the workspace/temp volume and re-run (df -h and du -sh on the sandbox parent).","Point the runtime parent at a volume with more headroom (the destination_parent passed to the graph builder).","Check dmesg/journalctl for EIO or remount-read-only events; replace the failing disk.","Raise the runner's disk quota if a quota (not capacity) caused ENOSPC."],"exampleFix":"# before: run on a 1 GiB tmpfs that fills up\nTMPDIR=/run/user/1000 wfbench run ...\n# after: use a larger scratch volume\nTMPDIR=/var/tmp/scratch wfbench run ...","handlingStrategy":"try-catch","validationCode":"import shutil, os\nfrom pathlib import Path\n\nruntime_parent = Path(\"/var/tmp/wfbench\")\nfree = shutil.disk_usage(runtime_parent).free\nif free < 512 * 1024 * 1024:\n    raise SystemExit(f\"insufficient disk space at {runtime_parent}: {free} bytes free\")","typeGuard":"import os\n\ndef can_write_exhaustively(path: os.PathLike, payload: bytes) -> bool:\n    try:\n        with open(path, \"wb\") as fh:\n            view = memoryview(payload)\n            while view:\n                n = os.write(fh.fileno(), view)\n                if n <= 0:\n                    return False\n                view = view[n:]\n        return True\n    except OSError:\n        return False","tryCatchPattern":"try:\n    _neutralize_target_index_inputs(clone_root)\nexcept OSError as exc:\n    if \"short write while neutralizing\" in str(exc):\n        log.error(\"disk/IO failure writing control file: %s\", exc)\n        # free space, fix FS, then re-run the sanitized graph build\n    raise","preventionTips":["Ensure the runtime/scratch volume has ample free space before graph prep.","Point TMPDIR / destination_parent at a healthy local disk, not a synced folder.","Watch dmesg/journalctl for EIO or remount-read-only events on the bench runner."],"tags":["sandbox","graph","filesystem","io-error","disk-full","workflow-bench"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}