{"record":{"id":"d35e755054e3cc85","repo":"windmill-labs/windmill","slug":"job-not-found-or-parent-flow-not-in-queue","errorCode":null,"errorMessage":"job not found or parent flow not in queue: {}","messagePattern":"job not found or parent flow not in queue: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-api/src/jobs.rs","lineNumber":5370,"sourceCode":"            q.suspend AS \"suspend!\",\n            j.runnable_path AS script_path,\n            j.permissioned_as_email AS email,\n            (ji.kind IN ('flow', 'flowpreview', 'singlestepflow')) AS \"is_flow_level!\",\n            (ji.kind NOT IN ('flow', 'flowpreview', 'singlestepflow') AND q.id = ji.id) AS \"is_wac!\"\n        FROM job_info ji\n        JOIN v2_job_queue q ON q.id = CASE\n            WHEN ji.kind IN ('flow', 'flowpreview', 'singlestepflow') THEN ji.id\n            ELSE COALESCE(ji.parent_job, ji.id)\n        END\n        JOIN v2_job j ON j.id = q.id\n        LEFT JOIN v2_job_status s ON s.id = q.id\n        FOR UPDATE OF q\n        \"#,\n        job_id,\n    )\n    .fetch_optional(db)\n    .await?\n    .ok_or_else(|| anyhow::anyhow!(\"job not found or parent flow not in queue: {}\", job_id))?;\n\n    let flow_info = FlowInfo {\n        id: result.id,\n        flow_status: result.flow_status,\n        suspend: result.suspend,\n        script_path: result.script_path,\n        email: Some(result.email),\n    };\n\n    Ok((flow_info, result.is_flow_level, result.is_wac))\n}\n\nasync fn get_suspended_flow_info<'c>(\n    job_id: Uuid,\n    tx: &mut Transaction<'c, Postgres>,\n) -> error::Result<(FlowInfo, Uuid, bool)> {\n    let flow = sqlx::query_as!(\n            FlowInfo,","sourceCodeStart":5352,"sourceCodeEnd":5388,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-api/src/jobs.rs#L5352-L5388","documentation":"Resuming a step requires its parent flow job to exist and be currently sitting in the queue (locked FOR UPDATE on the queue row). This error is thrown when the query finds no such job: the job id is wrong, the flow is not queued, or the parent flow row cannot be locked.","triggerScenarios":"POSTing a resume for a step whose parent flow already finished; resuming a job id that belongs to a script, not a suspended flow step; the parent flow was canceled or purged before the resume arrived.","commonSituations":"Calling the resume API with the step job id instead of an id resolvable through a queued parent flow; racing a canceled flow; stale webhook URLs after the run completed.","solutions":["Verify the flow run is still suspended/queued in the runs UI before resuming","Use the correct job identifier for the suspended step (not the completed run's id)","Re-run the flow if it already completed or was canceled — resumption is impossible","Check that the parent flow job was not purged by retention/cleanup policies"],"exampleFix":"// before\nresumeFlow(wId, completedRunId, resumeId) // throws\n// after\nconst run = await getRun(wId, flowId);\nif (run.state === 'suspended') resumeFlow(wId, flowId, resumeId);","handlingStrategy":"validation","validationCode":"// only attempt resume when the flow run is still waiting\nconst run = await client.getJobRun(wId, flowJobId);\nif (run.state !== 'suspended' && run.state !== 'waiting') {\n  throw new Error('flow not resumable (state: ' + run.state + ')');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await client.resumeStep(wId, flowJobId, resumeId, payload);\n} catch (e) {\n  if (/job not found or parent flow not in queue/.test(e.message)) {\n    // run already finished/canceled: surface as a no-op, don't retry\n  } else throw e;\n}","preventionTips":["Check run state before resuming","Don't reuse resume URLs after the run completes","Distinguish step job ids from flow job ids"],"tags":["flow","resume","job-queue","not-found"],"backgroundTag":"job-not-found","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}