{"record":{"id":"b54ae0ad5d394fc4","repo":"windmill-labs/windmill","slug":"timed-out-waiting-for-flow-id-to-complete","errorCode":null,"errorMessage":"Timed out waiting for flow ${id} to complete","messagePattern":"Timed out waiting for flow (.+?) to complete","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/flow/flow.ts","lineNumber":595,"sourceCode":"\n      if (jobInfo.success === false) {\n        process.exitCode = 1;\n      }\n\n      if (opts.silent) {\n        console.log(JSON.stringify(jobInfo.result ?? {}));\n      } else {\n        log.info(JSON.stringify(jobInfo.result ?? {}, null, 2));\n      }\n\n      break;\n    } catch {\n      retries++;\n      await new Promise((resolve) => setTimeout(resolve, 100));\n    }\n  }\n  if (retries >= MAX_RETRIES) {\n    throw new Error(`Timed out waiting for flow ${id} to complete`);\n  }\n}\n\nasync function preview(\n  opts: GlobalOptions & {\n    data?: string;\n    silent: boolean;\n    remote?: boolean;\n    step?: string;\n    tag?: string;\n  } & SyncOptions,\n  flowPath: string\n) {\n  if (opts.silent) {\n    log.setSilent(true);\n  }\n  const useLocalPathScripts = !opts.remote;\n  // Captured before the config read, which chdirs to the wmill.yaml root.","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/flow/flow.ts#L577-L613","documentation":"`wmill flow run` polls the queued flow job for completion and gives up after MAX_RETRIES (with 100ms sleeps), throwing this timeout. It means the flow did not reach a terminal state within the polling budget, not necessarily that the flow failed.","triggerScenarios":"`wmill flow run <path>` where the flow runs longer than the retry window, or the poll loop cannot read the job (the catch branch also increments retries on transient API errors).","commonSituations":"Long-running flows (scheduled loads, heavy scripts); slow workers or no worker picking up the job; transient network/auth hiccups during polling consuming the retry budget.","solutions":["Re-run with a longer wait or check the run in the web UI / `wmill flow status` to see if it eventually completed","Check that workers are running and consuming from the right tag/queue","Reduce flow runtime or split it; use schedules/webhooks instead of blocking CLI runs","Check network stability between CLI and the instance"],"exampleFix":"// before\nwmill flow run u/myuser/etl_flow\n// after\nwmill flow run u/myuser/etl_flow --async && wmill flow status <jobId>","handlingStrategy":"try-catch","validationCode":"// Nothing to check before; instead pick --async for flows that may exceed the poll window\nif (flowMayRunLong) useAsyncMode = true;","typeGuard":null,"tryCatchPattern":"try {\n  await client.flow.run(flowPath);\n} catch (e) {\n  if (String(e).startsWith('Timed out waiting for flow')) {\n    // job may still be running: check status instead of re-queuing\n    const status = await checkFlowRunStatus(jobId);\n  }\n}","preventionTips":["Use `--async` (or webhook/schedule) for long-running flows","Confirm workers are online and tagged for the flow's tag","Monitor queue depth on the instance before batch runs","Don't assume timeout = failure; check the job in the UI"],"tags":["cli","timeout","polling"],"backgroundTag":"job-poll-timeout","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"}