abhigyanpatwari/GitNexus · error · ValueError

task {index} requires a nonblank string {field}

Error message

task {index} requires a nonblank string {field}

What it means

Raised by select_tasks while validating each entry of the YAML task list. The harness requires five nonblank string fields per task — id, class, repo, prompt, verify (see required_strings at runner_tasks.py:31). This error fires when any of those is missing, is not a str instance, or strips to empty. The runner converts it into a CLI exit via parser.error (runner.py:942).

Source

Thrown at eval/workflow_bench/runner_tasks.py:39

        raise ValueError(f"{flag} must not use a mutable auto/latest model alias: {model!r}")
    return model


def select_tasks(tasks: list[Any], *, include_expensive: bool) -> tuple[list[dict[str, Any]], list[str]]:
    """Validate task metadata and filter opt-in expensive scenarios."""

    selected: list[dict[str, Any]] = []
    skipped: list[str] = []
    seen: set[str] = set()
    required_strings = ("id", "class", "repo", "prompt", "verify")
    optional_strings = ("ref", "setup")
    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")

View on GitHub (pinned to d540b00184)

Solutions

  1. Open the tasks file named in the error and jump to task index {index}; ensure the named {field} is present as a nonempty quoted string.
  2. Run `yq '.tasks[].{field}' tasks.yaml` (or a quick python yaml.safe_load) to find null/blank entries.
  3. Re-run with the corrected YAML.

Example fix

# before
- id: refactor-cli
  class: ts
  repo: /repos/gitnexus
  prompt: ""
  verify: "true"
# after
- id: refactor-cli
  class: ts
  repo: /repos/gitnexus
  prompt: "Refactor the CLI entrypoint"
  verify: "true"
Defensive patterns

Strategy: validation

Validate before calling

import yaml
REQUIRED = ("id", "class", "repo", "prompt", "verify")
doc = yaml.safe_load(open("tasks.yaml"))
for i, t in enumerate(doc.get("tasks", [])):
    for f in REQUIRED:
        v = t.get(f)
        if not isinstance(v, str) or not v.strip():
            raise SystemExit(f"task {i} requires a nonblank string {f}")

Type guard

def has_required_strings(task: object) -> bool:
    if not isinstance(task, dict):
        return False
    return all(
        isinstance(task.get(f), str) and task.get(f).strip()
        for f in ("id", "class", "repo", "prompt", "verify")
    )

Prevention

When it happens

Trigger: A task mapping omits one of the required keys, supplies None / a number / a list, or uses a whitespace-only value. YAML nulls (bare key with no value), unquoted numbers for class, or an empty prompt/verify string all trip it.

Common situations: Editing the tasks YAML and forgetting the verify key; setting prompt to a YAML anchor that resolves to empty; quoting id but leaving prompt blank; converting a hand-written task list and dropping a field.

Related errors


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