{"record":{"id":"2331f796133d308d","repo":"abhigyanpatwari/GitNexus","slug":"evidence-path-is-unreadable-value-exc","errorCode":null,"errorMessage":"evidence path is unreadable: {value}: {exc}","messagePattern":"evidence path is unreadable: (.+?): (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/proposer_sandbox.py","lineNumber":196,"sourceCode":")\n\n\ndef redact_text(text: str, secrets: Sequence[str] = ()) -> str:\n    for secret in secrets:\n        if secret:\n            text = text.replace(secret, \"[REDACTED]\")\n    text = _TOKEN_PATTERNS[0].sub(\"[REDACTED]\", text)\n    text = _TOKEN_PATTERNS[1].sub(\"[REDACTED]\", text)\n    text = _TOKEN_PATTERNS[2].sub(r\"\\1[REDACTED]\", text)\n    return _TOKEN_PATTERNS[3].sub(r\"\\1[REDACTED]@\", text)\n\n\ndef _evidence_bytes(value: Any, secrets: Sequence[str]) -> bytes:\n    if isinstance(value, Path):\n        try:\n            mode = value.lstat().st_mode\n        except OSError as exc:\n            raise SandboxError(f\"evidence path is unreadable: {value}: {exc}\") from exc\n        if value.is_symlink() or not stat.S_ISREG(mode):\n            raise SandboxError(f\"evidence must be a regular non-symlink file: {value}\")\n        if value.stat().st_size > MAX_EVIDENCE_FILE_BYTES:\n            raise SandboxError(f\"evidence exceeds the per-file limit: {value}\")\n        raw = value.read_bytes()\n        return redact_text(raw.decode(errors=\"replace\"), secrets).encode()\n    if isinstance(value, bytes):\n        raw = value\n    elif isinstance(value, str):\n        raw = value.encode()\n    else:\n        raw = (json.dumps(value, sort_keys=True, separators=(\",\", \":\")) + \"\\n\").encode()\n    return redact_text(raw.decode(errors=\"replace\"), secrets).encode()\n\n\ndef stage_evidence_bundle(\n    destination: Path,\n    entries: Mapping[str, Any],","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/proposer_sandbox.py#L178-L214","documentation":"Raised by _evidence_bytes when a Path evidence value cannot be lstat()'d. The sandbox stages an owner-only redacted evidence bundle and must inspect each file's mode before reading it; an OSError from lstat (ENOENT, EACCES, ELOOP) means the file is not inspectable, so staging aborts before any bytes are read.","triggerScenarios":"Calling stage_evidence_bundle (or _evidence_bytes) with an entry whose value is a pathlib.Path that does not exist, is on an unreadable parent directory, has a dangling symlink in the path, or sits behind a permission boundary the staging process cannot cross.","commonSituations":"Test/oracle code resolves a path relative to the wrong cwd; evidence path was created under a tmp dir that got cleaned up between phases; NFS/sshfs mount dropped; CI runs as a user lacking read on the parent dir; a relative Path was constructed against the host root instead of the clone root.","solutions":["Verify the path exists and is readable from the process that calls stage_evidence_bundle before passing it: print(value, value.exists(), os.access(value.parent, os.R_OK)).","Ensure the Path is absolute and resolved under the clone/workspace root the staging process actually sees (staging runs in the parent driver, not inside bwrap).","Regenerate the evidence file if a prior phase was responsible for producing it, or switch the entry to bytes/str if the content is already in memory.","If the file lives under a transient mount, move it to a stable location (e.g. the session private_root) before staging."],"exampleFix":"// before\nbundle = stage_evidence_bundle(dest, {\"log.txt\": Path(\"run.log\")})\n// after\nlog = (clone / \"run.log\").resolve()\nif not log.is_file():\n    raise FileNotFoundError(f\"missing evidence: {log}\")\nbundle = stage_evidence_bundle(dest, {\"log.txt\": log})","handlingStrategy":"validation","validationCode":"def valid_evidence_path(value: Path) -> bool:\n    try:\n        mode = value.lstat().st_mode\n        return value.is_file() and not stat.S_ISLNK(mode)\n    except OSError:\n        return False\n\n# before staging:\nfor name, v in entries.items():\n    if isinstance(v, Path) and not valid_evidence_path(v):\n        raise ValueError(f'{name}: evidence path unreadable')","typeGuard":"from pathlib import Path\nimport stat\n\ndef is_readable_regular_file(value: Path) -> bool:\n    if not isinstance(value, Path):\n        return False\n    try:\n        mode = value.lstat().st_mode\n    except OSError:\n        return False\n    return stat.S_ISREG(mode) and not stat.S_ISLNK(mode)","tryCatchPattern":"try:\n    bundle = stage_evidence_bundle(dest, entries, secrets=secrets)\nexcept SandboxError as exc:\n    if 'unreadable' in str(exc):\n        log.warning('evidence path unreadable, regenerating: %s', exc)\n        regenerate_evidence()\n        raise\n    raise","preventionTips":["Resolve evidence paths to absolute form under a known root before staging.","Run a preflight lstat/read check on every Path entry.","Generate evidence files in a stable location that survives across phases.","Avoid staging paths from transient mounts."],"tags":["evidence","filesystem","sandbox","validation"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}