abhigyanpatwari/GitNexus · error · ValueError

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

Error message

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

What it means

Raised when two file declarations share the same 'target' path (compared by POSIX-normalized string). Each oracle target must be unique so staged oracle files never collide inside the model's worktree. Enforced via a running set of target.as_posix() values.

Source

Thrown at eval/workflow_bench/oracle_assets.py:111

        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


def _read_oracle_file(root: Path, relative: PurePosixPath) -> bytes:
    current = root

View on GitHub (pinned to d540b00184)

Solutions

  1. Assign each declaration a unique 'target' path within the worktree.
  2. If two logical outputs belong in one file, merge them into a single source file and a single target declaration.
  3. Check that target strings are not accidentally identical after POSIX normalization (trailing slashes, duplicate separators).

Example fix

// before
[{"source": "a.txt", "target": "out/result.json"},
 {"source": "b.txt", "target": "out/result.json"}]
// after
[{"source": "a.txt", "target": "out/result_a.json"},
 {"source": "b.txt", "target": "out/result_b.json"}]
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

def targets_are_unique(files: list) -> bool:
    tgt = [PurePosixPath(d["target"]).as_posix() for d in files]
    return len(tgt) == len(set(tgt))

Try / catch

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

Prevention

When it happens

Trigger: Two entries whose 'target' field is the same worktree-relative path, e.g. both writing to 'out/result.json' from different sources.

Common situations: Two oracle outputs that conceptually land in the same file; copy-paste of a declaration without updating target; expecting the harness to overwrite/merge targets.

Related errors


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