{"record":{"id":"196b33af460e3929","repo":"abhigyanpatwari/GitNexus","slug":"label-must-be-a-real-directory-root","errorCode":null,"errorMessage":"{label} must be a real directory: {root}","messagePattern":"(.+?) must be a real directory: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/runtime_mounts.py","lineNumber":146,"sourceCode":"\ndef ce_plugin_dir_for_arm(arm: str, snapshot: CePluginSnapshot | None) -> str | None:\n    \"\"\"Return Claude's fixed in-sandbox plugin path only for CE arms.\"\"\"\n\n    ce_plugin_mounts_for_arm(arm, snapshot)\n    return SANDBOX_CE_PLUGIN if arm in CE_ARMS else None\n\n\ndef _validated_runtime_root(path: Path, *, label: str) -> Path:\n    \"\"\"Return one real directory without accepting any symlink hop.\"\"\"\n\n    root = path.expanduser().absolute()\n    try:\n        mode = root.lstat().st_mode\n        resolved = root.resolve(strict=True)\n    except OSError as exc:\n        raise SandboxError(f\"{label} is unavailable: {root}: {exc}\") from exc\n    if stat.S_ISLNK(mode) or not stat.S_ISDIR(mode) or resolved != root:\n        raise SandboxError(f\"{label} must be a real directory: {root}\")\n    return root\n\n\ndef _validated_runtime_component(\n    root: Path,\n    relative: str,\n    target: str,\n    *,\n    directory: bool,\n) -> ReadOnlyMount:\n    \"\"\"Validate one direct runtime component before exposing only that path.\"\"\"\n\n    source = root / relative\n    try:\n        mode = source.lstat().st_mode\n        resolved = source.resolve(strict=True)\n    except OSError as exc:\n        raise SandboxError(f\"pinned GitNexus runtime component is unavailable: {source}: {exc}\") from exc","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/runtime_mounts.py#L128-L164","documentation":"Raised by _validated_runtime_root (runtime_mounts.py:145-146) when the path exists but is not acceptable: it is a symlink (S_ISLNK), not a directory (not S_ISDIR), or resolve(strict=True) differs from the absolute path — i.e. some component of the path is a symlink. The harness refuses symlink hops to keep the pinned runtime immutable and unspoofable.","triggerScenarios":"gitnexus is a symlink to elsewhere; the path is a regular file where a directory is expected; an intermediate path component is a symlink so resolved != absolute; a deployment that symlinks the runtime into place.","commonSituations":"Dev setups that symlink gitnexus to a shared location; Docker volumes that surface as symlinks; a file (e.g. dist) where a dir is required.","solutions":["Replace the symlink with the real directory (move the target into place).","Ensure no path component is a symlink — use `realpath <path>` and compare to the requested path.","Point the harness at the resolved real directory directly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(path).expanduser().absolute()\nif p.is_symlink() or not p.is_dir() or p.resolve(strict=True) != p:\n    raise SystemExit(f\"{label} must be a real directory (no symlinks): {p}\")","typeGuard":"import stat\nfrom pathlib import Path\ndef is_real_directory(path: str) -> bool:\n    p = Path(path).expanduser().absolute()\n    try:\n        mode = p.lstat().st_mode\n        return not stat.S_ISLNK(mode) and stat.S_ISDIR(mode) and p.resolve(strict=True) == p\n    except OSError:\n        return False","tryCatchPattern":null,"preventionTips":["Do not symlink the runtime or plugin dir into place; copy it.","Run `realpath <path>` and ensure it equals the requested path.","Avoid bind-mounts/symlinks in CI runners for the gitnexus checkout."],"tags":["workflow-bench","sandbox","filesystem","symlink","security"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}