{"record":{"id":"5c634745d0465cc8","repo":"bytedance/deer-flow","slug":"run-run-id-is-not-active-on-this-worker-and-cann","errorCode":null,"errorMessage":"Run {run_id} is not active on this worker and cannot be cancelled","messagePattern":"Run (.+?) is not active on this worker and cannot be cancelled","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"backend/app/gateway/routers/thread_runs.py","lineNumber":980,"sourceCode":"            return Response(status_code=204)\n        if wait and outcome == CancelOutcome.requested:\n            bridge = get_stream_bridge(request)\n            if record.store_only and bridge.supports_cross_process:\n                completed = await wait_for_run_completion(\n                    bridge,\n                    record,\n                    request,\n                    run_mgr,\n                )\n                if completed:\n                    return Response(status_code=204)\n        return Response(status_code=202)\n\n    if outcome == CancelOutcome.lease_valid_elsewhere:\n        await _raise_lease_valid_elsewhere(run_id, run_mgr, record)\n\n    # not_cancellable, not_active_locally, unknown\n    raise HTTPException(status_code=409, detail=_cancel_conflict_detail(run_id, record))\n\n\n@router.get(\"/{thread_id}/runs/{run_id}/join\")\n@require_permission(\"runs\", \"read\", owner_check=True)\nasync def join_run(thread_id: ThreadId, run_id: str, request: Request) -> StreamingResponse:\n    \"\"\"Join an existing run's SSE stream.\"\"\"\n    run_mgr = get_run_manager(request)\n    record = await run_mgr.get(run_id)\n    if record is None or record.thread_id != thread_id:\n        raise HTTPException(status_code=404, detail=f\"Run {run_id} not found\")\n    bridge = get_stream_bridge(request)\n    if record.store_only and not bridge.supports_cross_process:\n        raise HTTPException(status_code=409, detail=f\"Run {run_id} is not active on this worker and cannot be streamed\")\n\n    return StreamingResponse(\n        sse_consumer(bridge, record, request, run_mgr),\n        media_type=\"text/event-stream\",\n        headers={","sourceCodeStart":962,"sourceCodeEnd":998,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/thread_runs.py#L962-L998","documentation":"Error \"Run {run_id} is not active on this worker and cannot be cancelled\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/app/gateway/routers/thread_runs.py:980 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The run is owned by another worker; wait for it to finish or for its lease to expire, then cancel.","If the owning worker is down, reconciliation will mark the run orphaned; retry after that."],"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"}