{"record":{"id":"5863e037f144d0ab","repo":"abhigyanpatwari/GitNexus","slug":"task-task-id-field-field-must-be-a-string","errorCode":null,"errorMessage":"task {task['id']} field {field} must be a string","messagePattern":"task (.+?) field (.+?) must be a string","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/runner_tasks.py","lineNumber":42,"sourceCode":"\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):\n            raise ValueError(f\"task {task_id} sandbox_copy must be a string list\")\n        dependencies = task.get(\"sandbox_dependencies\", [])\n        if not isinstance(dependencies, list):\n            raise ValueError(f\"task {task_id} sandbox_dependencies must be a list\")\n        for dependency in dependencies:\n            if (\n                not isinstance(dependency, Mapping)","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/runner_tasks.py#L24-L60","documentation":"Raised by select_tasks after the required-string check passes. The optional fields ref and setup (optional_strings at runner_tasks.py:32) must be strings if present. Unlike the required fields, blank/whitespace-only is permitted here — only the str type is enforced.","triggerScenarios":"A task sets ref to a YAML list (e.g. a multi-line block folded wrong) or to a number, or sets setup to null/mapping. The check is `field in task and not isinstance(task[field], str)`.","commonSituations":"Writing `ref: HEAD` works but `ref: [HEAD]` does not; `setup:` with no value yields None and trips it; an automated task generator emitting setup as an object.","solutions":["Inspect the offending task's ref/setup value and confirm it is a scalar string.","If you need no ref/setup, remove the key entirely rather than leaving it null.","Quote the value in YAML to avoid implicit type coercion."],"exampleFix":"# before\n- id: t1\n  ref:\n    - main\n# after\n- id: t1\n  ref: main","handlingStrategy":"type-guard","validationCode":"OPTIONAL = (\"ref\", \"setup\")\nfor i, t in enumerate(doc.get(\"tasks\", [])):\n    for f in OPTIONAL:\n        if f in t and not isinstance(t[f], str):\n            raise SystemExit(f\"task {i} field {f} must be a string\")","typeGuard":"def optional_fields_are_strings(task: dict) -> bool:\n    return all(\n        f not in task or isinstance(task[f], str)\n        for f in (\"ref\", \"setup\")\n    )","tryCatchPattern":null,"preventionTips":["Omit ref/setup when unused rather than leaving null.","Quote scalar values in YAML to avoid implicit non-string coercion."],"tags":["workflow-bench","task-validation","yaml"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}