abhigyanpatwari/GitNexus · error · ValueError

oracle source is unreadable: {relative}

Error message

oracle source is unreadable: {relative}

What it means

Raised by _read_oracle_file when os.open() (with O_RDONLY | O_NOFOLLOW) on the oracle source file raises OSError for any reason other than the pre-open ValueError checks. This covers permission denied, file vanished between lstat and open, I/O errors, or filesystem-level refusal. The NUL/symlink checks are re-raised as their own ValueErrors; everything else funnels here.

Source

Thrown at eval/workflow_bench/oracle_assets.py:148

    for part in relative.parts[:-1]:
        current /= part
        try:
            metadata = current.lstat()
        except OSError as exc:
            raise ValueError(f"oracle parent is unreadable: {relative}") from exc
        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):
            raise ValueError(f"oracle parents must be real directories: {relative}")

    path = root.joinpath(*relative.parts)
    try:
        before = path.lstat()
        if stat.S_ISLNK(before.st_mode) or not stat.S_ISREG(before.st_mode):
            raise ValueError(f"oracle source must be a bounded regular non-symlink file: {relative}")
        descriptor = os.open(path, os.O_RDONLY | getattr(os, "O_NOFOLLOW", 0))
    except ValueError:
        raise
    except OSError as exc:
        raise ValueError(f"oracle source is unreadable: {relative}") from exc
    try:
        opened = os.fstat(descriptor)
        if (
            stat.S_ISLNK(before.st_mode)
            or not stat.S_ISREG(before.st_mode)
            or not stat.S_ISREG(opened.st_mode)
            or before.st_dev != opened.st_dev
            or before.st_ino != opened.st_ino
            or opened.st_size > MAX_ORACLE_FILE_BYTES
        ):
            raise ValueError(f"oracle source must be a bounded regular non-symlink file: {relative}")
        chunks: list[bytes] = []
        remaining = MAX_ORACLE_FILE_BYTES + 1
        while remaining > 0:
            chunk = os.read(descriptor, min(64 * 1024, remaining))
            if not chunk:
                break
            chunks.append(chunk)

View on GitHub (pinned to d540b00184)

Solutions

  1. Check read permissions on the oracle source file: chmod/chown so the harness user can read it.
  2. Re-run capture — a transient filesystem error may not recur.
  3. Ensure no concurrent process is modifying or removing oracle assets during capture.
  4. Verify the file is still present with ls -l immediately before capture.
Defensive patterns

Strategy: try-catch

Validate before calling

import os
from pathlib import Path

def assert_readable(root: Path, relative) -> None:
    p = root.joinpath(*Path(relative).parts)
    if not os.access(p, os.R_OK):
        raise PermissionError(f"oracle file not readable: {p}")

Type guard

def oracle_file_readable(root, relative) -> bool:
    import os
    p = Path(root).joinpath(*Path(relative).parts)
    return os.access(p, os.R_OK)

Try / catch

try:
    payload = _read_oracle_file(root, relative)
except ValueError as exc:
    if "unreadable" in str(exc):
        raise SystemExit(f"Permission/access error on oracle file {relative}: {exc}") from exc
    raise

Prevention

When it happens

Trigger: The oracle file exists and is regular but the process lacks read permission; the file is deleted between the lstat and the open call; a filesystem error occurs during open; O_NOFOLLOW is enforced and the kernel rejects the path.

Common situations: Oracle files installed with restrictive ownership (root-owned, mode 0o400 owned by another user); container user mismatch; NFS/filesystem hiccup; TOCTOU where the file is removed mid-capture.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/5b3b92698104ad66. Report an issue: GitHub.