abhigyanpatwari/GitNexus · error · ValueError

oracle snapshot count does not match selected tasks

Error message

oracle snapshot count does not match selected tasks

What it means

Raised by resolve_task_bindings when the supplied `oracle_snapshots` list length differs from the tasks list (runner_tasks.py:111-112). The runner normally captures snapshots via capture_task_oracles just before calling this; a mismatch indicates the caller hand-passed an inconsistent snapshot list.

Source

Thrown at eval/workflow_bench/runner_tasks.py:112

        **dependency_binding,
        **oracle_snapshot.binding,
    }


def resolve_task_bindings(
    tasks: list[dict[str, Any]],
    expected: list[dict[str, Any]] | None = None,
    *,
    oracle_snapshots: list[TaskOracleSnapshot] | None = None,
    task_asset_cache: TaskAssetCache | None = None,
) -> list[dict[str, Any]]:
    """Resolve each repo/ref once and optionally honor an upstream immutable pin."""

    if expected is not None and len(expected) != len(tasks):
        raise ValueError("task binding count does not match selected tasks")
    snapshots = oracle_snapshots if oracle_snapshots is not None else capture_task_oracles(tasks)
    if len(snapshots) != len(tasks):
        raise ValueError("oracle snapshot count does not match selected tasks")
    bindings: list[dict[str, Any]] = []
    for index, (task, oracle_snapshot) in enumerate(zip(tasks, snapshots, strict=True)):
        requested_repo = Path(task["repo"]).expanduser().resolve()
        repo_output = run_checked(
            ["git", "-C", str(requested_repo), "rev-parse", "--show-toplevel"],
            timeout=60,
        ).stdout_tail.strip()
        repo_identity = Path(repo_output).resolve()
        if expected is None:
            resolved_sha = run_checked(
                [
                    "git",
                    "-C",
                    str(repo_identity),
                    "rev-parse",
                    f"{task.get('ref', 'HEAD')}^{{commit}}",
                ],
                timeout=60,

View on GitHub (pinned to d540b00184)

Solutions

  1. Pass oracle_snapshots=None to let the function capture them itself, matching the current tasks.
  2. If supplying explicitly, rebuild the list from the same tasks in the same order.
  3. Verify no task was filtered between capture and resolve.
Defensive patterns

Strategy: validation

Validate before calling

if oracle_snapshots is not None and len(oracle_snapshots) != len(tasks):
    raise SystemExit("oracle snapshot list length != task count")

Type guard

def snapshot_count_matches(tasks: list, snapshots: list | None) -> bool:
    return snapshots is None or len(snapshots) == len(tasks)

Prevention

When it happens

Trigger: Calling resolve_task_bindings with oracle_snapshots captured from a different/older task list; passing a partial snapshot list; snapshots filtered after capture.

Common situations: Programmatic use of resolve_task_bindings outside runner.main; tests passing hand-built snapshots of the wrong length.

Related errors


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