{"record":{"id":"27ca81c882a3d7a8","repo":"abhigyanpatwari/GitNexus","slug":"task-index-must-be-a-mapping","errorCode":null,"errorMessage":"task {index} must be a mapping","messagePattern":"task (.+?) must be a mapping","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/runner_tasks.py","lineNumber":35,"sourceCode":"    model = (value or \"\").strip()\n    if not model:\n        raise ValueError(f\"{flag} must name a nonblank, versioned model\")\n    if re.search(r\"(?:^|[-/@:])(?:auto|latest)$\", model.casefold()):\n        raise ValueError(f\"{flag} must not use a mutable auto/latest model alias: {model!r}\")\n    return model\n\n\ndef select_tasks(tasks: list[Any], *, include_expensive: bool) -> tuple[list[dict[str, Any]], list[str]]:\n    \"\"\"Validate task metadata and filter opt-in expensive scenarios.\"\"\"\n\n    selected: list[dict[str, Any]] = []\n    skipped: list[str] = []\n    seen: set[str] = set()\n    required_strings = (\"id\", \"class\", \"repo\", \"prompt\", \"verify\")\n    optional_strings = (\"ref\", \"setup\")\n    for index, raw_task in enumerate(tasks):\n        if not isinstance(raw_task, Mapping):\n            raise ValueError(f\"task {index} must be a mapping\")\n        task = dict(raw_task)\n        for field in required_strings:\n            if not isinstance(task.get(field), str) or not task[field].strip():\n                raise ValueError(f\"task {index} requires a nonblank string {field}\")\n        for field in optional_strings:\n            if field in task and not isinstance(task[field], str):\n                raise ValueError(f\"task {task['id']} field {field} must be a string\")\n        task_id = task[\"id\"]\n        if not re.fullmatch(r\"[A-Za-z0-9][A-Za-z0-9._-]{0,127}\", task_id):\n            raise ValueError(f\"task id must be a simple artifact-safe slug: {task_id!r}\")\n        if task_id in seen:\n            raise ValueError(f\"duplicate task id: {task_id}\")\n        seen.add(task_id)\n        expensive = task.get(\"expensive\", False)\n        if not isinstance(expensive, bool):\n            raise ValueError(f\"task {task_id} expensive metadata must be boolean\")\n        copies = task.get(\"sandbox_copy\", [])\n        if not isinstance(copies, list) or not all(isinstance(path, str) and path for path in copies):","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/runner_tasks.py#L17-L53","documentation":"Thrown by select_tasks while iterating the raw task list from the benchmark config. Each entry must be a Mapping (dict-like) so the harness can read its required string fields (id, class, repo, prompt, verify); a non-mapping entry (a string, number, list, None) cannot satisfy that contract, so it is rejected with the offending index for easy location.","triggerScenarios":"In the tasks loop, isinstance(raw_task, Mapping) is False for the entry at position `index`. The YAML/JSON list contains a scalar or null where a task object was expected.","commonSituations":"A YAML list item was written as a string instead of a mapping (- task_id instead of - id: task_id); a null entry from a template placeholder; a JSON array mixing objects and scalars; a copy-paste left a bare comment-stripped line.","solutions":["Make every item in the tasks list a mapping with the required keys: {id, class, repo, prompt, verify}.","Validate the parsed config with a schema (jsonschema/pydantic) before passing to select_tasks.","Check the reported index in the error and fix that specific list entry.","Lint the tasks file to ensure each - item is an object."],"exampleFix":"# before (tasks.yaml)\ntasks:\n  - my-task-id          # scalar, not a mapping\n\n# after\ntasks:\n  - id: my-task-id\n    class: implementation\n    repo: https://github.com/org/repo\n    prompt: \"Implement X\"\n    verify: \"npm test\"","handlingStrategy":"type-guard","validationCode":"from collections.abc import Mapping\n\ndef tasks_are_mappings(tasks: list) -> bool:\n    return all(isinstance(t, Mapping) for t in tasks)","typeGuard":"from collections.abc import Mapping\n\ndef is_task_mapping(value) -> bool:\n    return isinstance(value, Mapping)","tryCatchPattern":"from collections.abc import Mapping\ntry:\n    selected, skipped = select_tasks(tasks, include_expensive=False)\nexcept ValueError as e:\n    if 'must be a mapping' in str(e):\n        # the reported index points at a non-dict entry; fix the tasks file\n        raise\n    raise","preventionTips":["Ensure every list item in tasks.yaml/json is a mapping with required keys.","Validate the parsed config with a schema (jsonschema/pydantic) before select_tasks.","Use the error's index to locate the offending entry.","Lint the tasks file so each '- ' item is an object, not a scalar."],"tags":["validation","task-config","config-schema","workflow-bench"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}