{"record":{"id":"6807fcf590f5af43","repo":"Significant-Gravitas/AutoGPT","slug":"execution-not-found-or-not-in-queued-status","errorCode":null,"errorMessage":"Execution not found or not in QUEUED status","messagePattern":"Execution not found or not in QUEUED status","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/admin/diagnostics_admin_routes.py","lineNumber":408,"sourceCode":"\n    ⚠️ WARNING: Only use for stuck executions. This will re-execute and may cost credits.\n\n    Args:\n        request: Contains execution_id to requeue\n\n    Returns:\n        Success status and message\n    \"\"\"\n    logger.info(f\"Admin {user.user_id} requeueing execution {request.execution_id}\")\n\n    # Get the execution (validation - must be QUEUED)\n    executions = await get_graph_executions(\n        graph_exec_id=request.execution_id,\n        statuses=[AgentExecutionStatus.QUEUED],\n    )\n\n    if not executions:\n        raise HTTPException(\n            status_code=404,\n            detail=\"Execution not found or not in QUEUED status\",\n        )\n\n    execution = executions[0]\n\n    # Use add_graph_execution in requeue mode. ``bypass_paywall=True``\n    # because admins are recovering stuck executions on behalf of users\n    # who may now be on NO_TIER — the original run was already gated.\n    await add_graph_execution(\n        graph_id=execution.graph_id,\n        user_id=execution.user_id,\n        graph_version=execution.graph_version,\n        graph_exec_id=request.execution_id,  # Requeue existing execution\n        bypass_paywall=True,\n    )\n\n    return RequeueExecutionResponse(","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/admin/diagnostics_admin_routes.py#L390-L426","documentation":"HTTP 404 from the admin execution-requeue endpoint. get_graph_executions was called with graph_exec_id AND statuses=[AgentExecutionStatus.QUEUED]; an empty result means either no execution exists with that id, or it exists but is no longer QUEUED (already RUNNING, COMPLETED, FAILED, or STOPPED). Requeue is only valid for executions stuck in the queue.","triggerScenarios":"POST /admin/execution/requeue with a stale execution_id (already picked up by the executor), a typo'd UUID, or an execution that already completed/failed. Race: the admin checks the list, the executor starts the run, then the requeue request lands and finds no QUEUED row.","commonSituations":"Recovering executions after a RabbitMQ/executor outage — by the time an admin acts, some listed executions have already started; double-submitting the requeue form; copying the wrong id from the diagnostics table.","solutions":["Re-fetch the execution's current status (admin diagnostics list) and only requeue while it still shows QUEUED.","Verify the execution_id UUID against the AgentGraphExecution table.","If the execution is RUNNING, use the stop endpoint instead; if COMPLETED/FAILED, create a new run.","Retry the requeue once — a transient race with the executor scheduler may clear."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const exec = await getExecution(request.executionId);\nif (!exec || exec.status !== 'QUEUED') { /* refresh the admin table; don't requeue */ }","typeGuard":"function isRequeueable(e: { status: string }): boolean { return e.status === 'QUEUED'; }","tryCatchPattern":"try { await requeueExecution(executionId); } catch (e) { if (e.status === 404) { const exec = await getExecution(executionId); if (!exec) reportMissing(); else if (exec.status === 'RUNNING') await stopExecution(executionId); /* else already terminal */ } }","preventionTips":["Refresh execution status immediately before requeuing.","Treat 404 as a signal to re-check state, not as a hard failure.","Prevent double-submits of the requeue action."],"tags":["http-404","admin-api","execution","status-race"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}