{"record":{"id":"c89c43186b4e90fc","repo":"abhigyanpatwari/GitNexus","slug":"candidate-destination-is-unreadable-relative","errorCode":null,"errorMessage":"candidate destination is unreadable: {relative}: {exc}","messagePattern":"candidate destination is unreadable: (.+?): (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/evolution.py","lineNumber":195,"sourceCode":"                os.mkdir(part, mode=0o700, dir_fd=descriptor)\n            except FileExistsError:\n                pass\n            try:\n                child = os.open(part, directory_flags, dir_fd=descriptor)\n            except OSError as exc:\n                raise ValueError(\n                    f\"candidate destination parent must be a real directory: {relative.parent}: {exc}\"\n                ) from exc\n            os.close(descriptor)\n            descriptor = child\n\n        leaf = relative.name\n        try:\n            existing = os.stat(leaf, dir_fd=descriptor, follow_symlinks=False)\n        except FileNotFoundError:\n            existing = None\n        except OSError as exc:\n            raise ValueError(f\"candidate destination is unreadable: {relative}: {exc}\") from exc\n        if existing is not None and (stat.S_ISLNK(existing.st_mode) or not stat.S_ISREG(existing.st_mode)):\n            raise ValueError(f\"candidate destination must be a regular non-symlink file: {relative}\")\n\n        temporary = f\".wfbench-overlay-{secrets.token_hex(12)}\"\n        temp_descriptor = os.open(\n            temporary,\n            os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, \"O_NOFOLLOW\", 0),\n            0o600,\n            dir_fd=descriptor,\n        )\n        try:\n            view = memoryview(content)\n            while view:\n                written = os.write(temp_descriptor, view)\n                if written <= 0:\n                    raise OSError(\"short write while staging candidate overlay\")\n                view = view[written:]\n            os.fchmod(temp_descriptor, 0o644)","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/evolution.py#L177-L213","documentation":"Thrown by _replace_regular_file (evolution.py:195) when os.stat of the leaf file (dir_fd-relative, follow_symlinks=False) raises an OSError other than FileNotFoundError. The leaf exists but its metadata cannot be read — permission denied, ELOOP, or another filesystem-level error.","triggerScenarios":"The destination leaf already exists in the clone but stat fails due to EACCES (no permission on the parent dir or the file), ELOOP, or an I/O error from the underlying filesystem.","commonSituations":"Clone files left with restrictive modes from a prior sandbox run; running the harness as a different user than the one that created the clone; a failing/networked filesystem under the clone.","solutions":["Fix permissions on the leaf and its parent directory (chmod u+rw, parent u+rx).","If the leaf is stale from a prior run, remove it so the harness creates a fresh file.","Move the clone to a healthy local filesystem and retry."],"exampleFix":"# before: existing leaf unreadable\n# stat raises PermissionError -> 'candidate destination is unreadable'\n\n# after: ensure the leaf is readable/removable\nleaf = clone / '.claude/skills/gitnexus-work/SKILL.md'\nif leaf.exists():\n    leaf.chmod(0o644)  # or leaf.unlink() to let the harness recreate it","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\n\ndef leaf_is_accessible(clone: Path, rel: Path) -> bool:\n    leaf = clone / rel\n    if not leaf.exists() and not leaf.is_symlink():\n        return True\n    try:\n        os.stat(leaf, follow_symlinks=False)\n        return True\n    except OSError:\n        return False","typeGuard":"null","tryCatchPattern":"try:\n    apply_candidate_overlay(overlay, worktree, sandbox=sandbox)\nexcept ValueError as exc:\n    if 'destination is unreadable' in str(exc):\n        # chmod or remove the offending leaf, then retry\n        ...","preventionTips":["Run the harness as the user that owns the clone.","Reset stale clone files (chmod u+rw) before applying an overlay.","Keep the clone on a healthy local filesystem."],"tags":["filesystem","permissions","overlay","clone"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}