{"record":{"id":"fb2ba89bf4d3e8e4","repo":"bytedance/deer-flow","slug":"run-run-id-is-active-on-another-worker-retry-af","errorCode":null,"errorMessage":"Run {run_id} is active on another worker; retry after lease expiry.","messagePattern":"Run (.+?) is active on another worker; retry after lease expiry\\.","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"backend/app/gateway/routers/thread_runs.py","lineNumber":254,"sourceCode":"async def _raise_lease_valid_elsewhere(\n    run_id: str,\n    run_mgr,  # RunManager (avoid import for testability)\n    record: RunRecord,\n) -> None:\n    \"\"\"Re-fetch the lease and raise HTTP 409 + Retry-After.\n\n    ``record.lease_expires_at`` may be stale (fetched at request start while\n    the owner renewed between our read and the conditional UPDATE). Re-read\n    from the store to get the fresh value so ``Retry-After`` is accurate.\n    \"\"\"\n    fresh = await run_mgr.get(run_id)\n    if fresh is not None:\n        record = fresh\n    retry_after = _compute_retry_after(record.lease_expires_at, run_mgr.grace_seconds)\n    headers: dict[str, str] = {}\n    if retry_after is not None:\n        headers[\"Retry-After\"] = str(retry_after)\n    raise HTTPException(\n        status_code=409,\n        detail=f\"Run {run_id} is active on another worker; retry after lease expiry.\",\n        headers=headers,\n    )\n\n\ndef _record_to_response(record: RunRecord) -> RunResponse:\n    kwargs = dict(record.kwargs or {})\n    if \"config\" in kwargs:\n        kwargs[\"config\"] = redact_config_secrets(kwargs[\"config\"])\n\n    return RunResponse(\n        run_id=record.run_id,\n        thread_id=record.thread_id,\n        assistant_id=record.assistant_id,\n        status=record.status.value,\n        metadata=redact_metadata_secrets(record.metadata),\n        kwargs=kwargs,","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/thread_runs.py#L236-L272","documentation":"Error \"Run {run_id} is active on another worker; retry after lease expiry.\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/app/gateway/routers/thread_runs.py:254 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the run's lease to expire (or the run to finish) and retry the operation.","If the other worker crashed, run reconciliation will release the lease automatically; retry shortly."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}