windmill-labs/windmill · error
Cannot preview step of type '${moduleValue?.type ?? "unknown
Error message
Cannot preview step of type '${moduleValue?.type ?? "unknown"}'. Supported types: rawscript, script, flow. What it means
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.
Source
Thrown at cli/src/commands/flow/flow.ts:846
// Anchor to the script's own deployed path so its relative imports
// resolve against the workspace tree (or temp_script_refs).
path: moduleValue.path,
flow_path: flowWmPath,
args,
tag,
temp_script_refs: tempScriptRefs,
},
});
} else if (moduleValue?.type === "flow") {
log.info(colors.yellow(`Previewing step '${stepId}' (flow ${moduleValue.path})...`));
jobId = await wmill.runFlowByPath({
workspace: workspace.workspaceId,
path: moduleValue.path,
tag,
requestBody: args,
});
} else {
throw new Error(
`Cannot preview step of type '${moduleValue?.type ?? "unknown"}'. Supported types: rawscript, script, flow.`
);
}
const { result, success } = await pollForJobResult(workspace.workspaceId, jobId);
if (!success) {
if (silent) {
console.log(JSON.stringify(result));
} else {
log.info(colors.red.bold(`Step '${stepId}' failed:`));
log.info(JSON.stringify(result, null, 2));
}
process.exitCode = 1;
return;
}
if (silent) {View on GitHub (pinned to e474e8803c)
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
Example fix
// before wmill flow preview .flow/__flow --step myForLoop // after wmill flow preview .flow/__flow --step innerScript # a rawscript/script/flow module
Defensive patterns
Strategy: validation
Validate before calling
const supported = ['rawscript', 'script', 'flow'];
const mod = findStepInFlowValue(flow.value, stepId);
if (!mod || !supported.includes(mod.value?.type)) throw new Error(`step ${stepId} is not previewable`); Type guard
function isPreviewableModule(m: any): m is { value: { type: 'rawscript' | 'script' | 'flow' } } {
return ['rawscript', 'script', 'flow'].includes(m?.value?.type);
} Prevention
- 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
When it happens
Trigger: `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').
Common situations: 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.
Related errors
- App ${appPath} not found
- Dependency generation failed: ${queueResponse.status} ${queu
- Failed to poll dependencies job ${jobId}: ${e?.message ?? e}
- No response body for SSE stream
- Datatable '${dtName}' already exists in this workspace
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/097994ebfc2fc763.
Report an issue: GitHub.