nexu-io/open-design · error · SystemExit

{output} already exists; pass --force to replace it

Error message

{output} already exists; pass --force to replace it

What it means

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.

Source

Thrown at skills/hatch-pet/scripts/record_imagegen_result.py:201

    job = find_job(manifest, args.job_id)

    missing_deps = [
        dep
        for dep in job.get("depends_on", [])
        if isinstance(dep, str) and dep not in completed_job_ids(manifest)
    ]
    if missing_deps:
        raise SystemExit(
            f"job {args.job_id} is not ready; missing dependency result(s): {', '.join(missing_deps)}"
        )
    validate_required_grounding(job, run_dir)

    output_raw = job.get("output_path")
    if not isinstance(output_raw, str):
        raise SystemExit(f"job {args.job_id} has no output_path")
    output = run_dir / output_raw
    if output.exists() and not args.force:
        raise SystemExit(f"{output} already exists; pass --force to replace it")

    output.parent.mkdir(parents=True, exist_ok=True)
    shutil.copy2(source, output)
    metadata = image_metadata(output)

    job["status"] = "complete"
    job["source_path"] = str(source)
    job["source_provenance"] = source_provenance
    job["source_sha256"] = file_sha256(source)
    job["output_sha256"] = file_sha256(output)
    if source_provenance == "synthetic-test":
        job["synthetic_test_source"] = True
    else:
        job.pop("synthetic_test_source", None)
    job["completed_at"] = datetime.now(timezone.utc).isoformat()
    job["metadata"] = metadata
    for key in [
        "last_error",

View on GitHub (pinned to 5be4028344)

Solutions

  1. Pass --force if you intentionally want to overwrite the recorded output.
  2. Run queue_pet_repairs.py first so the previous output is archived under decoded/repair-archive before re-recording.
  3. Delete the existing output file manually if you are sure.
  4. Record against a fresh run_dir if you need to keep both versions.

Example fix

# before
record_imagegen_result.py --job-id idle --source ig_002.png   # output already exists
# after
record_imagegen_result.py --job-id idle --source ig_002.png --force
Defensive patterns

Strategy: validation

Validate before calling

output = run_dir / output_raw
if output.exists() and not args.force:
    raise SystemExit(f"{output} exists; pass --force or run queue_pet_repairs.py first")

Prevention

When it happens

Trigger: 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.

Common situations: Iterating on a row and re-recording over the old result; repair flow that should have archived the previous output did not run.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/b7bb4bde8dc2156a. Report an issue: GitHub.