{"record":{"id":"d7c8418bc795b8de","repo":"abhigyanpatwari/GitNexus","slug":"sandbox-copy-path-is-unavailable-relative-exc","errorCode":null,"errorMessage":"sandbox_copy path is unavailable: {relative}: {exc}","messagePattern":"sandbox_copy path is unavailable: (.+?): (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/task_assets.py","lineNumber":628,"sourceCode":"            os.close(current)\n            current = child\n        return current\n    except BaseException:\n        os.close(current)\n        raise\n\n\ndef _open_child(\n    parent_descriptor: int,\n    name: str,\n    relative: PurePosixPath,\n    *,\n    require_directory: bool = False,\n) -> int:\n    try:\n        metadata = os.stat(name, dir_fd=parent_descriptor, follow_symlinks=False)\n    except OSError as exc:\n        raise SandboxError(f\"sandbox_copy path is unavailable: {relative}: {exc}\") from exc\n    if stat.S_ISLNK(metadata.st_mode):\n        raise SandboxError(f\"sandbox_copy must not traverse a symlink: {relative}\")\n    if require_directory and not stat.S_ISDIR(metadata.st_mode):\n        raise SandboxError(f\"sandbox_copy parent must be a directory: {relative}\")\n    if not (stat.S_ISDIR(metadata.st_mode) or stat.S_ISREG(metadata.st_mode)):\n        raise SandboxError(f\"sandbox_copy accepts only regular files and directories: {relative}\")\n    flags = os.O_RDONLY | getattr(os, \"O_CLOEXEC\", 0) | getattr(os, \"O_NOFOLLOW\", 0)\n    if stat.S_ISDIR(metadata.st_mode):\n        flags |= os.O_DIRECTORY\n    else:\n        flags |= getattr(os, \"O_NONBLOCK\", 0)\n    try:\n        descriptor = os.open(name, flags, dir_fd=parent_descriptor)\n    except OSError as exc:\n        raise SandboxError(f\"sandbox_copy path changed or is unreadable: {relative}: {exc}\") from exc\n    opened = os.fstat(descriptor)\n    if not (stat.S_ISDIR(opened.st_mode) or stat.S_ISREG(opened.st_mode)):\n        os.close(descriptor)","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/task_assets.py#L610-L646","documentation":"Raised by _open_child when os.stat(name, dir_fd=<parent>, follow_symlinks=False) raises OSError while walking a declared sandbox_copy path from the repo root via _open_relative. The original OSError (ENOENT, EACCES, EPERM, ENOTDIR, etc.) is chained in the message after the relative path. This is the catch-all for any path component that cannot be inspected during snapshot capture.","triggerScenarios":"A sandbox_copy declaration names a path that does not exist at the resolved_sha; a parent dir lacks read/execute permission for the harness process; a path component is a regular file blocking further directory traversal (ENOTDIR); the worktree was partially checked out (sparse).","commonSituations":"Task YAML references a file renamed/removed between commit pins; running the harness as a user without read access to the worktree; a typo in the declaration path; sparse-checkout excluded the declared subtree.","solutions":["Verify the declared path exists at the resolved SHA: `git -C <repo> cat-file -e <sha>:<path>`","Check permissions on the worktree and every parent: `namei -l <repo>/<path>`","Confirm the worktree is not sparse: `git -C <repo> sparse-checkout list` and re-checkout fully if needed","Correct the task declaration to point at a path present at that SHA"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\n\ndef declared_paths_exist(repo: Path, resolved_sha: str, declarations: list[str]) -> list[str]:\n    missing = []\n    for decl in declarations:\n        p = repo / decl\n        try:\n            if not p.lstat(strict=True):\n                missing.append(decl)\n        except (FileNotFoundError, NotADirectoryError, PermissionError) as exc:\n            missing.append(f\"{decl}: {exc}\")\n    return missing\n# call before TaskAssetCache.prepare(...); abort if non-empty","typeGuard":null,"tryCatchPattern":"from eval.workflow_bench.proposer_sandbox import SandboxError\n\ntry:\n    snapshot = cache.prepare(task, repo=repo, resolved_sha=sha)\nexcept SandboxError as exc:\n    if \"path is unavailable\" in str(exc):\n        # declaration/permission problem; do not retry with the same inputs\n        raise SystemExit(f\"sandbox_copy declaration invalid: {exc}\") from exc\n    raise","preventionTips":["Validate every sandbox_copy declaration path resolves at the resolved SHA before calling prepare","Run the harness with a user that has read+execute on the entire worktree","Avoid sparse checkouts for benchmark repos; fully materialize the worktree"],"tags":["sandbox","sandbox-copy","permissions","missing-path"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}