windmill-labs/windmill · error
Module value is undefined for module ${module.id}
Error message
Module value is undefined for module ${module.id} What it means
replaceInlineScripts walks a flow's module tree and, for each module, inlines file contents back into the flow definition before pushing. If `module.value` is undefined — the module has no value payload at all — it throws `Module value is undefined for module <id>`. A well-formed flow module (rawscript, flow, etc.) always carries a value, so this indicates a malformed flow definition or an incomplete/incorrectly-shaped parsed module.
Source
Thrown at cli/windmill-utils-internal/src/inline-scripts/replacer.ts:86
export async function replaceInlineScripts(
modules: FlowModule[],
fileReader: (path: string) => Promise<string>,
logger: {
info: (message: string) => void,
error: (message: string) => void,
} = {
info: () => {},
error: () => {},
},
localPath: string,
separator: string = "/",
removeLocks?: string[],
missingFiles?: string[],
): Promise<string[]> {
const missing = missingFiles ?? [];
await Promise.all(modules.map(async (module) => {
if (!module.value) {
throw new Error(`Module value is undefined for module ${module.id}`);
}
if (module.value.type === "rawscript") {
await replaceRawscriptInline(
module.id,
module.value,
fileReader,
logger,
separator,
removeLocks,
missing
);
} else if (module.value.type === "forloopflow" || module.value.type === "whileloopflow") {
await replaceInlineScripts(module.value.modules, fileReader, logger, localPath, separator, removeLocks, missing);
} else if (module.value.type === "branchall") {
await Promise.all(module.value.branches.map(async (branch) => {
await replaceInlineScripts(branch.modules, fileReader, logger, localPath, separator, removeLocks, missing);
}));View on GitHub (pinned to e474e8803c)
Solutions
- Open the flow YAML at the failing module `id` and add back its `value` block (type + content/inputs)
- Restore the flow file from git (`git checkout -- <file>`) to recover the missing value
- Re-pull the flow with `wmill sync pull` so the definition is rebuilt from the backend
- If generating flows in code, ensure every module gets a non-null `value` before calling replaceInlineScripts
Example fix
// before
{
"id": "a",
"value": undefined // module missing value
}
// after
{
"id": "a",
"value": { "type": "rawscript", "content": "...", "language": "python3" }
} Defensive patterns
Strategy: type-guard
Validate before calling
interface FlowModuleLike { id: string; value?: unknown }
function allModulesHaveValue(modules: FlowModuleLike[]): boolean {
return modules.every(m => m.value != null);
}
if (!allModulesHaveValue(flow.value.modules)) throw new Error('Flow has modules without value'); Type guard
function hasModuleValue(m: { id: string; value?: unknown }): m is { id: string; value: object } {
return m.value != null && typeof m.value === 'object';
} Try / catch
try {
await replaceInlineScripts(flow.value.modules, ...);
} catch (e) {
if ((e as Error).message.startsWith('Module value is undefined')) {
console.error('Flow definition malformed — restore from git or re-pull');
} else throw e;
} Prevention
- Validate flow YAML shape (every module has id + value) before pushing
- Never resolve merge conflicts by deleting a module's value block
- Type generated flow objects so a missing value is a compile-time error
When it happens
Trigger: replaceInlineScripts called on modules from a flow YAML where a module entry lacks its `value` key (e.g. hand-edited flow file, a module type the parser did not resolve, or a flow/suspend branch whose value was stripped by tooling).
Common situations: Manually editing a flow YAML and deleting or renaming the `value` block; a merge conflict resolved by dropping a module's value; generating flows programmatically with a missing value for some module id; version skew where an old flow format lacks value on a new module type.
Related errors
- Cannot push flow ${remotePath}: missing inline script file(s
- Cannot push flow ${remotePath}: step(s) reference non-worksp
- Refusing to extract corrupted inline script for module '${id
- Invalid AI agent provider configuration: ${errors.join('\n')
- Invalid ${field}:\n${errors.join('\n')}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/7815e7c281282992.
Report an issue: GitHub.