{"record":{"id":"591539aefc72cbce","repo":"abhigyanpatwari/GitNexus","slug":"plan-artifact-must-be-a-regular-file-path","errorCode":null,"errorMessage":"plan artifact must be a regular file: {path}","messagePattern":"plan artifact must be a regular file: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/runner_artifacts.py","lineNumber":271,"sourceCode":"\ndef snapshot_plan_docs(worktree: Path) -> dict[Path, str]:\n    \"\"\"Hash direct, regular plan artifacts without following links.\"\"\"\n\n    plans = worktree / \"docs\" / \"plans\"\n    if not plans.exists():\n        return {}\n    if plans.is_symlink() or not plans.is_dir():\n        raise ValueError(f\"plan directory must be a real directory: {plans}\")\n\n    snapshot: dict[Path, str] = {}\n    for path in sorted(plans.iterdir()):\n        if path.suffix.lower() not in {\".md\", \".html\"}:\n            continue\n        metadata = path.lstat()\n        if stat.S_ISLNK(metadata.st_mode):\n            raise ValueError(f\"plan artifact cannot be a symlink: {path}\")\n        if not stat.S_ISREG(metadata.st_mode):\n            raise ValueError(f\"plan artifact must be a regular file: {path}\")\n        descriptor = os.open(path, os.O_RDONLY | getattr(os, \"O_NOFOLLOW\", 0))\n        try:\n            opened = os.fstat(descriptor)\n            if not stat.S_ISREG(opened.st_mode) or opened.st_dev != metadata.st_dev or opened.st_ino != metadata.st_ino:\n                raise ValueError(f\"plan artifact changed while opening: {path}\")\n            with os.fdopen(descriptor, \"rb\", closefd=False) as handle:\n                snapshot[path] = hashlib.file_digest(handle, \"sha256\").hexdigest()\n            after = os.fstat(descriptor)\n            if (opened.st_size, opened.st_mtime_ns) != (after.st_size, after.st_mtime_ns):\n                raise ValueError(f\"plan artifact changed while hashing: {path}\")\n        finally:\n            os.close(descriptor)\n    return snapshot\n\n\ndef new_plan_doc(worktree: Path, before: dict[Path, str]) -> Path:\n    \"\"\"Return the sole new or modified plan, rejecting ambiguous evidence.\"\"\"\n","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/runner_artifacts.py#L253-L289","documentation":"Raised by snapshot_plan_docs (runner_artifacts.py:271) when a .md/.html file under docs/plans is not a regular file (and not a symlink, which error 478 catches first). Plan artifacts must be regular files so they can be hashed; a FIFO, device node, socket, or other special file is rejected before the hash.","triggerScenarios":"path.lstat().st_mode is neither S_ISLNK (caught at 269) nor S_ISREG for a .md/.html entry. The model or setup created a special file (mkfifo, mknod) named like a plan, or the filesystem reports a degenerate type.","commonSituations":"A misbehaving tool creates a FIFO or device node where a plan file is expected; a corrupted filesystem entry; a test fixture that accidentally commits a special file.","solutions":["Inspect the offending path (ls -l <path>) and remove the special file; recreate a regular file in its place.","Ensure the planning phase writes plan content via normal file APIs (open/write), not mknod/mkfifo.","Re-clone the worktree if the special file was committed by mistake."],"exampleFix":"# before\nmkfifo docs/plans/plan.md   # or mknod\n\n# after\nrm docs/plans/plan.md\ncat > docs/plans/plan.md <<'EOF'\n# Plan\n...\nEOF","handlingStrategy":"validation","validationCode":"import stat\nfrom pathlib import Path\n\nplans = Path(worktree) / \"docs\" / \"plans\"\nif plans.is_dir():\n    for p in plans.iterdir():\n        if p.suffix.lower() in {\".md\", \".html\"}:\n            mode = p.lstat().st_mode\n            assert stat.S_ISREG(mode), (\n                f\"plan artifact is not a regular file: {p} (mode={stat.S_IFMT(mode):o})\")","typeGuard":"import stat\nfrom pathlib import Path\n\ndef all_plans_are_regular_files(worktree) -> bool:\n    plans = Path(worktree) / \"docs\" / \"plans\"\n    if not plans.is_dir():\n        return True\n    for p in plans.iterdir():\n        if p.suffix.lower() not in {\".md\", \".html\"}:\n            continue\n        mode = p.lstat().st_mode\n        if not stat.S_ISREG(mode):\n            return False\n    return True","tryCatchPattern":null,"preventionTips":["Write plan content via normal file APIs (open/write), never mknod/mkfifo.","Re-clone the worktree if a special file was committed by mistake.","Inspect any non-regular entry under docs/plans with ls -l before benchmarking."],"tags":["plan-docs","special-file","integrity"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}