{"record":{"id":"097994ebfc2fc763","repo":"windmill-labs/windmill","slug":"cannot-preview-step-of-type-modulevalue-type","errorCode":null,"errorMessage":"Cannot preview step of type '${moduleValue?.type ?? \"unknown\"}'. Supported types: rawscript, script, flow.","messagePattern":"Cannot preview step of type '(.+?)'\\. Supported types: rawscript, script, flow\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/flow/flow.ts","lineNumber":846,"sourceCode":"        // Anchor to the script's own deployed path so its relative imports\n        // resolve against the workspace tree (or temp_script_refs).\n        path: moduleValue.path,\n        flow_path: flowWmPath,\n        args,\n        tag,\n        temp_script_refs: tempScriptRefs,\n      },\n    });\n  } else if (moduleValue?.type === \"flow\") {\n    log.info(colors.yellow(`Previewing step '${stepId}' (flow ${moduleValue.path})...`));\n    jobId = await wmill.runFlowByPath({\n      workspace: workspace.workspaceId,\n      path: moduleValue.path,\n      tag,\n      requestBody: args,\n    });\n  } else {\n    throw new Error(\n      `Cannot preview step of type '${moduleValue?.type ?? \"unknown\"}'. Supported types: rawscript, script, flow.`\n    );\n  }\n\n  const { result, success } = await pollForJobResult(workspace.workspaceId, jobId);\n\n  if (!success) {\n    if (silent) {\n      console.log(JSON.stringify(result));\n    } else {\n      log.info(colors.red.bold(`Step '${stepId}' failed:`));\n      log.info(JSON.stringify(result, null, 2));\n    }\n    process.exitCode = 1;\n    return;\n  }\n\n  if (silent) {","sourceCodeStart":828,"sourceCodeEnd":864,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/flow/flow.ts#L828-L864","documentation":"Step preview only supports module types rawscript, script, and flow; when the resolved module has another type (e.g. approval, wait, loop, brancheval, or an unknown type due to a malformed module), the command refuses to run it as a job and throws.","triggerScenarios":"`wmill flow preview --step <id>` where the step is a control-flow module (forloop, branch, approval, sleep, etc.) or the module object is malformed so its type is undefined (printed as 'unknown').","commonSituations":"Trying to preview a forloop/branchone step; a hand-edited flow.yaml missing the `type` field so the module reads as unknown; attempting to preview trigger/router modules.","solutions":["Preview an executable step (rawscript/script/flow) instead of a control-flow module","If the type is 'unknown', fix the module entry in flow.yaml so it has a valid `type` field","Test control-flow behavior by previewing the whole flow rather than the step"],"exampleFix":"// before\nwmill flow preview .flow/__flow --step myForLoop\n// after\nwmill flow preview .flow/__flow --step innerScript  # a rawscript/script/flow module","handlingStrategy":"validation","validationCode":"const supported = ['rawscript', 'script', 'flow'];\nconst mod = findStepInFlowValue(flow.value, stepId);\nif (!mod || !supported.includes(mod.value?.type)) throw new Error(`step ${stepId} is not previewable`);","typeGuard":"function isPreviewableModule(m: any): m is { value: { type: 'rawscript' | 'script' | 'flow' } } {\n  return ['rawscript', 'script', 'flow'].includes(m?.value?.type);\n}","tryCatchPattern":null,"preventionTips":["Only pass executable step ids to --step; drive control-flow modules via whole-flow preview","Validate flow.yaml schema so every module has a recognized `type`","Avoid hand-editing module types in flow.yaml"],"tags":["cli","unsupported-type","step-preview"],"backgroundTag":"unsupported-module-type","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"}