{"record":{"id":"efe4f894a11d3874","repo":"zed-industries/zed","slug":"run-record-already-exists-namespace-experiment","errorCode":null,"errorMessage":"run record already exists: {namespace}/{experiment_name}/{run_id}","messagePattern":"run record already exists: (.+?)/(.+?)/(.+?)","errorType":"exception","errorClass":"FileExistsError","httpStatus":null,"severity":"error","filePath":"crates/eval_cli/zed_eval/modal_app.py","lineNumber":642,"sourceCode":"\n@app.function(\n    image=controller_image,\n    cpu=1,\n    memory=512,\n    timeout=300,\n    volumes={\"/data\": volume},\n)\ndef create_run_record(run_request: dict[str, Any]) -> dict[str, Any]:\n    namespace = run_request[\"namespace\"]\n    experiment_name = run_request[\"experiment_name\"]\n    run_id = run_request[\"run_id\"]\n    run_dir = pathlib.Path(\"/data/runs\") / namespace / experiment_name / run_id\n    state_path = run_dir / \"state.json\"\n\n    reload_volume()\n\n    if state_path.exists():\n        raise FileExistsError(\n            f\"run record already exists: {namespace}/{experiment_name}/{run_id}\"\n        )\n\n    run_dir.mkdir(parents=True, exist_ok=True)\n    write_run_inputs(run_dir, run_request)\n    state = {\n        \"run_id\": run_id,\n        \"namespace\": namespace,\n        \"experiment_name\": experiment_name,\n        \"status\": \"pending\",\n        \"created_at\": run_request.get(\"created_at\"),\n        \"updated_at\": utc_now(),\n        \"build_id\": run_request.get(\"build_id\"),\n    }\n    write_json(state_path, state)\n    volume.commit()\n    return state\n","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/eval_cli/zed_eval/modal_app.py#L624-L660","documentation":"Raised as FileExistsError by the Modal function create_run_record() when /data/runs/{namespace}/{experiment_name}/{run_id}/state.json already exists. The launch flow calls this synchronously (record_function.remote) before spawning the controller, so it is an intentional idempotency guard: a launch aborts before any compute if its run id collides with an existing run on the volume.","triggerScenarios":"Re-launching with the same explicit --run-id (explicit ids are used verbatim for the first leg); retrying a launch whose controller already started (the record exists even if the controller later died); two operators using the same run id under the same namespace/experiment. Auto-generated ids (timestamp+uuid) effectively never collide.","commonSituations":"Pinned --run-id values in CI that rerun on retry; re-running a scripted launch after a partial failure; deliberately reusing a memorable id for a re-run.","solutions":["Use a different --run-id (or drop the flag to let it auto-generate a unique timestamped id).","If you truly want to redo the run under the same id, delete the old record on the volume (/data/runs/<ns>/<experiment>/<run_id>) — but prefer keeping history and using a new id.","If the existing run is still healthy, just monitor it (zed-eval status <run_id>) instead of relaunching."],"exampleFix":"# before\nzed-eval run rf --run-id fixed-id   # second invocation\n# -> FileExistsError: run record already exists: me/swe-atlas-rf/fixed-id\n\n# after\nzed-eval run rf --run-id fixed-id-2   # or omit --run-id entirely","handlingStrategy":"fallback","validationCode":"# Prefer unique ids in wrappers; only pin --run-id if you also handle collisions:\nrun_id = args.run_id or f\"{utc_timestamp()}-{uuid.uuid4().hex[:6]}\"  # what the CLI does by default","typeGuard":null,"tryCatchPattern":"try:\n    record_state = record_function.remote(run_request)\nexcept FileExistsError:\n    # idempotency guard: reuse a fresh id (or inspect the existing run instead)\n    run_request[\"run_id\"] = f\"{run_request['run_id']}-{uuid.uuid4().hex[:6]}\"\n    record_state = record_function.remote(run_request)","preventionTips":["Omit --run-id (or append a unique suffix in CI) so ids never collide across retries.","Treat this error as a prompt to check the existing run: zed-eval status <run_id>.","Deleting /data/runs/<ns>/<experiment>/<run_id> to force reuse loses history; prefer new ids."],"tags":["cli","idempotency","remote-state","launch"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}