{"record":{"id":"627cc7ddf6597c6e","repo":"windmill-labs/windmill","slug":"unable-to-find-the-flow-status-in-the-flow-job","errorCode":null,"errorMessage":"unable to find the flow status in the flow job","messagePattern":"unable to find the flow status in the flow job","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-api/src/jobs.rs","lineNumber":5515,"sourceCode":"\n    // The resume secret is this route's gate, so it never reaches\n    // `require_job_read_access` and the run-scope confinement that gate carries. Re-apply\n    // it against the flow whose args and status are about to be returned: holding a\n    // resume secret must not let a scoped token read a flow it may not run. Anonymous\n    // approvers are unaffected.\n    if let Some(authed) = authed.as_ref() {\n        require_job_within_run_scope(&db, authed, &w_id, &flow_id).await?;\n    }\n\n    let flow = GetQuery::new()\n        .without_logs()\n        .without_code()\n        .fetch(&db, &flow_id, &w_id)\n        .await?;\n\n    let flow_status = flow\n        .flow_status()\n        .ok_or_else(|| anyhow::anyhow!(\"unable to find the flow status in the flow job\"))?;\n    let flow_module_status = flow_status\n        .modules\n        .iter()\n        .find(|p| p.job() == Some(job))\n        .ok_or_else(|| anyhow::anyhow!(\"unable to find the module\"))?;\n\n    let trigger_email = match &flow {\n        Job::CompletedJob(job) => &job.email,\n        Job::QueuedJob(job) => &job.email,\n    };\n    conditionally_require_authed_user(\n        authed.clone(),\n        flow_status.approval_conditions.clone(),\n        trigger_email,\n    )?;\n\n    let approvers_from_status = match flow_module_status {\n        FlowStatusModule::Success { approvers, .. } => approvers.to_owned(),","sourceCodeStart":5497,"sourceCodeEnd":5533,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-api/src/jobs.rs#L5497-L5533","documentation":"The flow job's flow_status JSON column is expected to contain the current FlowStatus (module states); this error fires when flow.flow_status() returns None — the job exists but carries no flow status payload. Only flow jobs should reach this code path, so a missing status means corrupt or absent internal state.","triggerScenarios":"Calling the approval page/status endpoint for a job whose flow_status column is null or unparsable — e.g. a non-flow job id passed to the route, or a run created before status was written.","commonSituations":"Passing a script/job id instead of the flow job id; runs from very old Windmill versions with a different flow_status schema; DB rows edited or partially migrated.","solutions":["Ensure you reference the flow job id, not a child script/step id","Re-run the flow; the run's internal state is unusable","Check Windmill version/upgrade path if old runs consistently lack flow_status","Inspect the jobs row's flow_status column to confirm it is valid JSON"],"exampleFix":"// before\ngetApprovalPage(wId, stepJobId) // step id has no flow_status\n// after\ngetApprovalPage(wId, flowJobId) // the flow run's own id","handlingStrategy":"validation","validationCode":"// ensure the id refers to a flow job before hitting approval endpoints\nconst run = await client.getJobRun(wId, jobId);\nif (run.kind !== 'flow') throw new Error('not a flow job: no flow status');","typeGuard":"function isFlowJob(run) {\n  return run != null && (run.kind === 'flow' || run.kind === 'flowpreview');\n}","tryCatchPattern":null,"preventionTips":["Use the flow job id, never a step/script id, for flow-level routes","Don't hand-edit jobs rows; let the engine write flow_status","Keep deployments consistent so old runs aren't read with new schemas"],"tags":["flow","flow-status","corrupt-state","not-found"],"backgroundTag":"missing-field","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"}