{"record":{"id":"cdaa9ad6bbff51bd","repo":"windmill-labs/windmill","slug":"step-stepid-not-found-in-flow-available-step","errorCode":null,"errorMessage":"Step '${stepId}' not found in flow. Available steps: ${available}","messagePattern":"Step '(.+?)' not found in flow\\. Available steps: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/flow/flow.ts","lineNumber":779,"sourceCode":"    log.info(colors.bold.underline.green(\"Flow preview completed\"));\n    log.info(JSON.stringify(result, null, 2));\n  }\n}\n\nasync function previewStep(\n  stepId: string,\n  localFlow: FlowFile,\n  flowWmPath: string,\n  workspace: { workspaceId: string },\n  baseArgs: Record<string, unknown>,\n  tempScriptRefs: Record<string, string> | undefined,\n  silent: boolean,\n  tag: string | undefined,\n) {\n  const module = findStepInFlowValue(localFlow.value, stepId);\n  if (!module) {\n    const available = collectStepIds(localFlow.value).join(\", \") || \"(none)\";\n    throw new Error(`Step '${stepId}' not found in flow. Available steps: ${available}`);\n  }\n\n  // The preprocessor module receives args via _ENTRYPOINT_OVERRIDE so the\n  // runner picks the preprocessor entrypoint (matches frontend behavior in\n  // copilot/chat/flow/core.ts).\n  const args =\n    stepId === \"preprocessor\"\n      ? { _ENTRYPOINT_OVERRIDE: \"preprocessor\", ...baseArgs }\n      : baseArgs;\n\n  const moduleValue = module.value;\n  let jobId: string;\n  if (moduleValue?.type === \"rawscript\") {\n    log.info(colors.yellow(`Previewing step '${stepId}' (rawscript, ${moduleValue.language})...`));\n    jobId = await wmill.runScriptPreview({\n      workspace: workspace.workspaceId,\n      requestBody: {\n        content: moduleValue.content ?? \"\",","sourceCodeStart":761,"sourceCodeEnd":797,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/flow/flow.ts#L761-L797","documentation":"`wmill flow preview --step <stepId>` looks up the step inside the local flow value via findStepInFlowValue; when no module matches the given id it throws, listing every valid step id collected from the flow for comparison.","triggerScenarios":"`wmill flow preview <flowPath> --step <id>` where the id is misspelled, refers to a step that was renamed/removed locally, or uses the wrong id form (nested/subflow ids).","commonSituations":"Editing flow.yaml by hand and forgetting to update a step reference; running an old command from shell history after refactoring the flow; wrong casing of the step id.","solutions":["Use one of the ids printed in 'Available steps' in the error message","Check the module ids in the local flow.yaml and correct the --step argument","Re-pull the flow (`wmill flow pull`) if the local copy is stale"],"exampleFix":"// before\nwmill flow preview .flow/__flow --step fetch_data\n// after\nwmill flow preview .flow/__flow --step fetchData  # id shown in 'Available steps'","handlingStrategy":"validation","validationCode":"const flow = await fsp.readFile(join(flowPath, 'flow.yaml'), 'utf8').then(parseFlowYaml);\nconst ids = collectStepIds(flow.value);\nif (!ids.includes(stepId)) throw new Error(`step '${stepId}' not in flow; available: ${ids.join(', ')}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a step-id list in a comment at the top of flow.yaml during manual edits","Never rename step ids without grepping the repo for references","Pull the latest flow before previewing a step","Match the exact casing of ids shown in the UI"],"tags":["cli","step-lookup","argument-error"],"backgroundTag":"step-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"}