abhigyanpatwari/GitNexus · error · ValueError

task {task_id} expensive metadata must be boolean

Error message

task {task_id} expensive metadata must be boolean

What it means

Raised by select_tasks when the optional `expensive` metadata flag is present but is not a Python bool (runner_tasks.py:50-51). Expensive tasks are opt-in (filtered unless --include-expensive), so the type must be strictly boolean — truthy ints/strings are rejected to avoid silent opt-in.

Source

Thrown at eval/workflow_bench/runner_tasks.py:51

    for index, raw_task in enumerate(tasks):
        if not isinstance(raw_task, Mapping):
            raise ValueError(f"task {index} must be a mapping")
        task = dict(raw_task)
        for field in required_strings:
            if not isinstance(task.get(field), str) or not task[field].strip():
                raise ValueError(f"task {index} requires a nonblank string {field}")
        for field in optional_strings:
            if field in task and not isinstance(task[field], str):
                raise ValueError(f"task {task['id']} field {field} must be a string")
        task_id = task["id"]
        if not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9._-]{0,127}", task_id):
            raise ValueError(f"task id must be a simple artifact-safe slug: {task_id!r}")
        if task_id in seen:
            raise ValueError(f"duplicate task id: {task_id}")
        seen.add(task_id)
        expensive = task.get("expensive", False)
        if not isinstance(expensive, bool):
            raise ValueError(f"task {task_id} expensive metadata must be boolean")
        copies = task.get("sandbox_copy", [])
        if not isinstance(copies, list) or not all(isinstance(path, str) and path for path in copies):
            raise ValueError(f"task {task_id} sandbox_copy must be a string list")
        dependencies = task.get("sandbox_dependencies", [])
        if not isinstance(dependencies, list):
            raise ValueError(f"task {task_id} sandbox_dependencies must be a list")
        for dependency in dependencies:
            if (
                not isinstance(dependency, Mapping)
                or set(dependency) != {"source", "target"}
                or not all(isinstance(dependency[field], str) and dependency[field] for field in ("source", "target"))
            ):
                raise ValueError(
                    f"task {task_id} sandbox_dependencies entries require nonblank source and target strings"
                )
        validate_oracle_declaration(task)
        if expensive and not include_expensive:
            skipped.append(task_id)

View on GitHub (pinned to d540b00184)

Solutions

  1. Set expensive as a bare YAML boolean: `expensive: true` or `expensive: false`.
  2. If the task is not expensive, remove the key (it defaults to False).
  3. Check your task generator emits bool, not stringified bool.

Example fix

# before
- id: t1
  expensive: "true"
# after
- id: t1
  expensive: true
Defensive patterns

Strategy: type-guard

Validate before calling

for i, t in enumerate(doc.get("tasks", [])):
    if "expensive" in t and not isinstance(t["expensive"], bool):
        raise SystemExit(f"task {i} expensive must be boolean")

Type guard

def expensive_is_bool(task: dict) -> bool:
    return "expensive" not in task or isinstance(task["expensive"], bool)

Prevention

When it happens

Trigger: Setting `expensive: true` (correct) vs `expensive: "true"`, `expensive: 1`, `expensive: yes`-coerced-to-non-bool, or `expensive: null`. YAML parses bare `true`/`false` to bool, but quoted strings or ints slip through as non-bool.

Common situations: Quoting `expensive: "true"`; using 1/0 from a generator; a templating system emitting a string.

Related errors


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