{"record":{"id":"b7bb4bde8dc2156a","repo":"nexu-io/open-design","slug":"output-already-exists-pass-force-to-replace-i-b7bb4b","errorCode":null,"errorMessage":"{output} already exists; pass --force to replace it","messagePattern":"(.+?) already exists; pass --force to replace it","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/record_imagegen_result.py","lineNumber":201,"sourceCode":"    job = find_job(manifest, args.job_id)\n\n    missing_deps = [\n        dep\n        for dep in job.get(\"depends_on\", [])\n        if isinstance(dep, str) and dep not in completed_job_ids(manifest)\n    ]\n    if missing_deps:\n        raise SystemExit(\n            f\"job {args.job_id} is not ready; missing dependency result(s): {', '.join(missing_deps)}\"\n        )\n    validate_required_grounding(job, run_dir)\n\n    output_raw = job.get(\"output_path\")\n    if not isinstance(output_raw, str):\n        raise SystemExit(f\"job {args.job_id} has no output_path\")\n    output = run_dir / output_raw\n    if output.exists() and not args.force:\n        raise SystemExit(f\"{output} already exists; pass --force to replace it\")\n\n    output.parent.mkdir(parents=True, exist_ok=True)\n    shutil.copy2(source, output)\n    metadata = image_metadata(output)\n\n    job[\"status\"] = \"complete\"\n    job[\"source_path\"] = str(source)\n    job[\"source_provenance\"] = source_provenance\n    job[\"source_sha256\"] = file_sha256(source)\n    job[\"output_sha256\"] = file_sha256(output)\n    if source_provenance == \"synthetic-test\":\n        job[\"synthetic_test_source\"] = True\n    else:\n        job.pop(\"synthetic_test_source\", None)\n    job[\"completed_at\"] = datetime.now(timezone.utc).isoformat()\n    job[\"metadata\"] = metadata\n    for key in [\n        \"last_error\",","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/record_imagegen_result.py#L183-L219","documentation":"Raised in record_imagegen_result.py main() when run_dir/<output_path> already exists and --force was not passed. The recorder refuses to overwrite a previously recorded output so repair history and hashes stay intact; pass --force to replace.","triggerScenarios":"Re-recording a job that was already completed; retrying after a partial run that wrote the output; recording again after a failed QA without archiving first.","commonSituations":"Iterating on a row and re-recording over the old result; repair flow that should have archived the previous output did not run.","solutions":["Pass --force if you intentionally want to overwrite the recorded output.","Run queue_pet_repairs.py first so the previous output is archived under decoded/repair-archive before re-recording.","Delete the existing output file manually if you are sure.","Record against a fresh run_dir if you need to keep both versions."],"exampleFix":"# before\nrecord_imagegen_result.py --job-id idle --source ig_002.png   # output already exists\n# after\nrecord_imagegen_result.py --job-id idle --source ig_002.png --force","handlingStrategy":"validation","validationCode":"output = run_dir / output_raw\nif output.exists() and not args.force:\n    raise SystemExit(f\"{output} exists; pass --force or run queue_pet_repairs.py first\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run queue_pet_repairs.py to archive the previous output before re-recording.","Pass --force only when you intentionally overwrite.","Keep one run_dir per attempt if you need both versions."],"tags":["filesystem","cli","hatch-pet","idempotency"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}