{"record":{"id":"afcee2facb5b183d","repo":"abhigyanpatwari/GitNexus","slug":"task-task-id-oracle-file-index-requires-exactl","errorCode":null,"errorMessage":"task {task_id} oracle file {index} requires exactly source and target","messagePattern":"task (.+?) oracle file (.+?) requires exactly source and target","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":105,"sourceCode":"    oracle = task.get(\"oracle\")\n    if not isinstance(oracle, dict) or set(oracle) != {\"command\", \"files\"}:\n        raise ValueError(f\"task {task_id} oracle requires exactly command and files\")\n    command = oracle.get(\"command\")\n    if (\n        not isinstance(command, str)\n        or not command.strip()\n        or len(command.encode()) > MAX_ORACLE_COMMAND_BYTES\n        or \"\\x00\" in command\n    ):\n        raise ValueError(f\"task {task_id} oracle command must be nonblank and bounded\")\n    files = oracle.get(\"files\")\n    if not isinstance(files, list) or not files or len(files) > MAX_ORACLE_FILES:\n        raise ValueError(f\"task {task_id} oracle files must contain 1..{MAX_ORACLE_FILES} entries\")\n    sources: set[str] = set()\n    targets: set[str] = set()\n    for index, declaration in enumerate(files):\n        if not isinstance(declaration, dict) or set(declaration) != {\"source\", \"target\"}:\n            raise ValueError(f\"task {task_id} oracle file {index} requires exactly source and target\")\n        source = _bounded_relative_path(declaration.get(\"source\"), label=f\"task {task_id} oracle source\")\n        target = _bounded_relative_path(declaration.get(\"target\"), label=f\"task {task_id} oracle target\")\n        if source.as_posix() in sources:\n            raise ValueError(f\"task {task_id} oracle source is duplicated: {source}\")\n        if target.as_posix() in targets:\n            raise ValueError(f\"task {task_id} oracle target is duplicated: {target}\")\n        sources.add(source.as_posix())\n        targets.add(target.as_posix())\n\n\ndef _real_oracle_root(root: Path) -> Path:\n    lexical = root.expanduser().absolute()\n    try:\n        metadata = lexical.lstat()\n        resolved = lexical.resolve(strict=True)\n    except OSError as exc:\n        raise ValueError(f\"oracle root is unavailable: {lexical}\") from exc\n    if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode) or resolved != lexical:","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L87-L123","documentation":"Raised inside the per-file loop of validate_oracle_declaration when one entry of oracle['files'] is not a dict whose key set is exactly {\"source\", \"target\"}. Each oracle file declaration pairs a harness-relative 'source' path with a worktree-relative 'target' path; extra or missing keys on any single entry are rejected, and the message includes the entry index for easy location.","triggerScenarios":"A files entry that is a plain string instead of a dict; a dict missing 'source' or 'target'; a dict with an extra key like 'mode' or 'checksum'; a typo such as 'src'/'dest'.","commonSituations":"Hand-writing file declarations and using inconsistent key names across entries; copy-pasting a different schema (e.g. {'path': ...}); adding an unsupported field expecting the harness to honor it.","solutions":["Shape every files entry as exactly {\"source\": <relpath>, \"target\": <relpath>}.","Use the reported index to find the offending entry (0-based).","Remove any unsupported keys; if you need checksum/mode semantics, they are computed by the harness, not declared."],"exampleFix":"// before\n{\"source\": \"a.txt\", \"dest\": \"a.txt\"}\n// after\n{\"source\": \"a.txt\", \"target\": \"a.txt\"}","handlingStrategy":"type-guard","validationCode":"for i, decl in enumerate(task[\"oracle\"][\"files\"]):\n    if not isinstance(decl, dict) or set(decl) != {\"source\", \"target\"}:\n        raise ValueError(f\"file entry {i} must be a dict with exactly source and target\")","typeGuard":"def is_valid_file_declaration(decl) -> bool:\n    return isinstance(decl, dict) and set(decl) == {\"source\", \"target\"}","tryCatchPattern":"try:\n    validate_oracle_declaration(task)\nexcept ValueError as exc:\n    print(f\"Bad oracle file declaration: {exc}\")","preventionTips":["Use a typed dataclass or TypedDict to author file declarations.","Lint task fixtures with a schema validator (e.g. jsonschema) before capture."],"tags":["python","benchmark","validation","oracle","schema"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}