abhigyanpatwari/GitNexus · error · ValueError

task {task_id} oracle command must be nonblank and bounded

Error message

task {task_id} oracle command must be nonblank and bounded

What it means

Raised when the oracle 'command' string fails one of four bounds: it must be a non-empty str, non-blank after strip(), its UTF-8 encoding must be ≤ MAX_ORACLE_COMMAND_BYTES (8192 bytes), and it must not contain a NUL byte (\x00). These bounds keep the command deterministic, portable, and free of injection-prone control characters. The check runs after the key-set check in validate_oracle_declaration.

Source

Thrown at eval/workflow_bench/oracle_assets.py:97

        raise ValueError(f"{label} cannot target git metadata: {value!r}")
    return relative


def validate_oracle_declaration(task: dict[str, Any]) -> None:
    """Validate the declarative shape without reading harness-owned files."""

    task_id = str(task.get("id", "<unknown>"))
    oracle = task.get("oracle")
    if not isinstance(oracle, dict) or set(oracle) != {"command", "files"}:
        raise ValueError(f"task {task_id} oracle requires exactly command and files")
    command = oracle.get("command")
    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())

View on GitHub (pinned to d540b00184)

Solutions

  1. Provide a short, non-empty command string like "pytest -q".
  2. If the command is large, move the logic into a script file referenced by the command instead of inlining it.
  3. Ensure command is a str, not a list — this field is a single shell command line.
  4. Strip any embedded NUL or control bytes from the value before assignment.

Example fix

// before
oracle = {"command": "", "files": [...]}
// after
oracle = {"command": "pytest -q tests/test_oracle.py", "files": [...]}
Defensive patterns

Strategy: validation

Validate before calling

from eval.workflow_bench.oracle_assets import MAX_ORACLE_COMMAND_BYTES

def valid_command(cmd):
    return (
        isinstance(cmd, str)
        and cmd.strip()
        and "\x00" not in cmd
        and len(cmd.encode()) <= MAX_ORACLE_COMMAND_BYTES
    )

Type guard

def is_valid_oracle_command(cmd) -> bool:
    return isinstance(cmd, str) and bool(cmd.strip()) and "\x00" not in cmd and len(cmd.encode()) <= 8192

Try / catch

try:
    validate_oracle_declaration(task)
except ValueError as exc:
    print(f"Fix the oracle command for task {task.get('id')}: {exc}")

Prevention

When it happens

Trigger: oracle["command"] is None or a non-string; an empty string or whitespace-only string; a command longer than 8 KiB once UTF-8 encoded; a command containing an embedded NUL byte.

Common situations: Leaving command as an empty placeholder while drafting a task; pasting a huge multi-line shell script into command instead of a short invocation; a command string that accidentally includes a literal \x00 from binary copy-paste; using a non-string type (e.g. a list of argv tokens) instead of a single shell string.

Related errors


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