abhigyanpatwari/GitNexus · error · ValueError

task {task_id} oracle source is duplicated: {source}

Error message

task {task_id} oracle source is duplicated: {source}

What it means

Raised when two file declarations share the same 'source' path (compared by POSIX-normalized string). Each oracle source must be unique so the harness captures a distinct, well-defined set of inputs. Deduplication is enforced via a running set of source.as_posix() values during validation.

Source

Thrown at eval/workflow_bench/oracle_assets.py:109

    if (
        not isinstance(command, str)
        or not command.strip()
        or len(command.encode()) > MAX_ORACLE_COMMAND_BYTES
        or "\x00" in command
    ):
        raise ValueError(f"task {task_id} oracle command must be nonblank and bounded")
    files = oracle.get("files")
    if not isinstance(files, list) or not files or len(files) > MAX_ORACLE_FILES:
        raise ValueError(f"task {task_id} oracle files must contain 1..{MAX_ORACLE_FILES} entries")
    sources: set[str] = set()
    targets: set[str] = set()
    for index, declaration in enumerate(files):
        if not isinstance(declaration, dict) or set(declaration) != {"source", "target"}:
            raise ValueError(f"task {task_id} oracle file {index} requires exactly source and target")
        source = _bounded_relative_path(declaration.get("source"), label=f"task {task_id} oracle source")
        target = _bounded_relative_path(declaration.get("target"), label=f"task {task_id} oracle target")
        if source.as_posix() in sources:
            raise ValueError(f"task {task_id} oracle source is duplicated: {source}")
        if target.as_posix() in targets:
            raise ValueError(f"task {task_id} oracle target is duplicated: {target}")
        sources.add(source.as_posix())
        targets.add(target.as_posix())


def _real_oracle_root(root: Path) -> Path:
    lexical = root.expanduser().absolute()
    try:
        metadata = lexical.lstat()
        resolved = lexical.resolve(strict=True)
    except OSError as exc:
        raise ValueError(f"oracle root is unavailable: {lexical}") from exc
    if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode) or resolved != lexical:
        raise ValueError(f"oracle root must be a real non-symlink directory: {lexical}")
    return lexical

View on GitHub (pinned to d540b00184)

Solutions

  1. Give each oracle file declaration a distinct 'source' path.
  2. If one source must map to multiple targets, reconsider the oracle design — the schema is 1:1 source-to-target.
  3. Re-run validate_oracle_declaration after editing to confirm the duplicate is gone.

Example fix

// before
[{"source": "expect.txt", "target": "a.txt"},
 {"source": "expect.txt", "target": "b.txt"}]
// after
[{"source": "expect_a.txt", "target": "a.txt"},
 {"source": "expect_b.txt", "target": "b.txt"}]
Defensive patterns

Strategy: validation

Validate before calling

sources = [PurePosixPath(d["source"]).as_posix() for d in task["oracle"]["files"]]
if len(sources) != len(set(sources)):
    dupes = {s for s in sources if sources.count(s) > 1}
    raise ValueError(f"duplicate oracle sources: {dupes}")

Type guard

def sources_are_unique(files: list) -> bool:
    src = [PurePosixPath(d["source"]).as_posix() for d in files]
    return len(src) == len(set(src))

Try / catch

try:
    validate_oracle_declaration(task)
except ValueError as exc:
    print(f"Resolve duplicate source: {exc}")

Prevention

When it happens

Trigger: Two entries in oracle['files'] whose 'source' field resolves to the same POSIX path string, e.g. both 'a/b.txt' and the equivalent 'a//b.txt' collapse, or literally identical source strings.

Common situations: Copy-pasting a file declaration and forgetting to change the source; intending two targets for one source (the harness forbids this — you must declare one canonical target).

Related errors


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