{"record":{"id":"c5f52cfa8c4c4c67","repo":"zed-industries/zed","slug":"provide-a-run-id-or-job-dir","errorCode":null,"errorMessage":"provide a run_id or --job-dir","messagePattern":"provide a run_id or --job-dir","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"crates/eval_cli/zed_eval/report.py","lineNumber":427,"sourceCode":"        for entry in report[\"errored_trials\"][:20]:\n            lines.append(f\"  - {entry['task_name']}: {entry['reason']}\")\n        if len(report[\"errored_trials\"]) > 20:\n            lines.append(f\"  ... and {len(report['errored_trials']) - 20} more\")\n        lines.append(\"\")\n\n    return \"\\n\".join(lines)\n\n\ndef locate_job_dir(args: Any) -> Path:\n    \"\"\"Resolve the fetched Harbor/Pier job directory for a `report` invocation,\n    fetching it first when asked.\"\"\"\n    job_dir = getattr(args, \"job_dir\", None)\n    if job_dir:\n        return Path(job_dir)\n\n    run_id = getattr(args, \"run_id\", None)\n    if not run_id:\n        raise ValueError(\"provide a run_id or --job-dir\")\n    jobs_dir = Path(getattr(args, \"jobs_dir\", Path.home() / \".cache/harbor/jobs\"))\n    candidate = jobs_dir / run_id\n\n    if getattr(args, \"fetch\", False) or not candidate.exists():\n        # Reuse the existing fetch command to download + extract the archive.\n        from .volume import command_fetch\n\n        command_fetch(args)\n    if not candidate.exists():\n        raise ValueError(\n            f\"no fetched job at {candidate}. Run `zed-eval fetch {run_id} \"\n            f\"--experiment-name <benchmark>` first, or pass --job-dir.\"\n        )\n    return candidate\n\n\ndef _timeout_is_failure(args: Any) -> bool:\n    \"\"\"Agent timeouts count as failures on test-scored benchmarks. Derived from","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/eval_cli/zed_eval/report.py#L409-L445","documentation":"locate_job_dir resolves which fetched Harbor/Pier job directory a `zed-eval report` invocation should read: it first honors an explicit --job-dir, then falls back to <jobs_dir>/<run_id>. If neither args.job_dir nor args.run_id is present, it raises this ValueError immediately, before anything is fetched or resolved.","triggerScenarios":"Running `zed-eval report` with no positional run id and no --job-dir; a wrapper script that drops empty arguments (empty string is falsy, same result); an argparse setup where both options are optional and the user supplied neither.","commonSituations":"Copy-pasting a report command from docs that still contains a placeholder run id; scripting report over many runs and passing an unset shell variable; interactive use on a machine with no prior runs in the index.","solutions":["Pass the run id: zed-eval report <run_id>","Or point at an already-fetched job: zed-eval report --job-dir ~/.cache/harbor/jobs/<run_id>","In scripts, guard against empty $RUN_ID before invoking the CLI","Check argparse wiring if you maintain a wrapper, so at least one source is required"],"exampleFix":"# before\nzed-eval report   # ValueError: provide a run_id or --job-dir\n\n# after\nzed-eval report 2026-08-20T10-00-00-abc123\n# or\nzed-eval report --job-dir ~/.cache/harbor/jobs/2026-08-20T10-00-00-abc123","handlingStrategy":"validation","validationCode":"if not (getattr(args, \"run_id\", None) or getattr(args, \"job_dir\", None)):\n    raise SystemExit(\"report needs a run id or --job-dir\")","typeGuard":null,"tryCatchPattern":"try:\n    job_dir = locate_job_dir(args)\nexcept ValueError as err:\n    raise SystemExit(f\"usage: {err}\")","preventionTips":["Make run_id a required positional in wrapper scripts","Fail fast on empty-string ids before invoking the CLI","Remember the last launched run id from the local index and reuse it in scripts"],"tags":["cli","usage","argument","zed-eval","report"],"backgroundTag":"missing-required-argument","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}