{"record":{"id":"e6c23865b60c8046","repo":"abhigyanpatwari/GitNexus","slug":"task-asset-snapshot-contains-a-special-directory","errorCode":null,"errorMessage":"task asset snapshot contains a special directory: {path}","messagePattern":"task asset snapshot contains a special directory: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/task_assets.py","lineNumber":1007,"sourceCode":"            mode = path.lstat().st_mode\n            relative = path.relative_to(root)\n            if stat.S_ISLNK(mode):\n                if not relative.parts or relative.parts[0] != \"dependencies\":\n                    raise SandboxError(f\"task asset snapshot contains an unexpected symlink: {path}\")\n                continue\n            if not stat.S_ISREG(mode):\n                raise SandboxError(f\"task asset snapshot contains a special file: {path}\")\n            path.chmod(0o400 | (0o100 if stat.S_IMODE(mode) & 0o111 else 0))\n        for name in directories:\n            path = Path(current) / name\n            mode = path.lstat().st_mode\n            relative = path.relative_to(root)\n            if stat.S_ISLNK(mode):\n                if not relative.parts or relative.parts[0] != \"dependencies\":\n                    raise SandboxError(f\"task asset snapshot contains an unexpected symlink: {path}\")\n                continue\n            if not stat.S_ISDIR(mode):\n                raise SandboxError(f\"task asset snapshot contains a special directory: {path}\")\n            path.chmod(0o500)\n        Path(current).chmod(0o500)\n\n\ndef _thaw_tree(root: Path) -> None:\n    for current, directories, files in os.walk(root, topdown=True, followlinks=False):\n        Path(current).chmod(0o700)\n        for name in directories:\n            path = Path(current) / name\n            if not path.is_symlink():\n                path.chmod(0o700)\n        for name in files:\n            path = Path(current) / name\n            if not path.is_symlink():\n                path.chmod(0o600)\n\n\ndef capture_task_dependency_binding(","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/task_assets.py#L989-L1025","documentation":"Raised by _freeze_snapshot during the directories walk when an entry listed as a directory is neither a symlink nor an actual directory (stat.S_ISDIR false). It is the directory-walk analogue of the 626 regular-file check: a non-directory, non-symlink entry in a directory slot is treated as a special file and rejected.","triggerScenarios":"Extremely rare: os.walk reports an entry under directories whose lstat mode is neither S_ISDIR nor S_ISLNK. Can happen with a FIFO/socket/device whose name happened to be classified as a directory by walk, on filesystems with unusual type reporting, or when an entry is racily replaced between the readdir and the lstat.","commonSituations":"TOCTOU between os.walk's readdir and the per-entry lstat (entry replaced mid-walk); exotic filesystems (some network/9p mounts) that misreport entry types; a corrupted index entry.","solutions":["Make the snapshot root quiescent during _freeze_snapshot (no concurrent writes/replaces), then re-prepare.","Remove the offending non-directory entry from the captured tree.","If the filesystem misreports types, capture from a stable local filesystem (ext4/xfs) instead of a network/9p mount."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os, stat\nfrom pathlib import Path\n\ndef assert_only_real_dirs(root: Path) -> None:\n    for current, dirs, _ in os.walk(root, followlinks=False):\n        for name in dirs:\n            mode = (Path(current) / name).lstat().st_mode\n            if not (stat.S_ISDIR(mode) or stat.S_ISLNK(mode)):\n                raise ValueError(f'non-directory in dir slot would be rejected by freeze: {Path(current)/name}')\n\n# Run against a quiescent tree (no concurrent writes) before cache.prepare.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the snapshot root quiescent during capture/freeze — no concurrent replacement of entries.","Capture from a stable local filesystem; avoid 9p/network mounts that misreport entry types.","Remove any non-directory entry that os.walk classifies as a directory."],"tags":["sandbox","filesystem","security","concurrency"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}