windmill-labs/windmill · error
Invalid preprocessor_module: only "rawscript" and "script" m
Error message
Invalid preprocessor_module: only "rawscript" and "script" modules are supported
What it means
A preprocessor_module must have a value of type "rawscript" or "script"; the preprocessor runs inline code before the flow body, so other module types (aiagent, flow, scriptloader, etc.) are invalid there. This complements the id check with a type check on the module's value.
Source
Thrown at frontend/src/lib/components/copilot/chat/flow/editableFlowJson.ts:387
flow.preprocessor_module,
'preprocessor_module'
)
const failureModule = validateOptionalFlowModule(flow.failure_module, 'failure_module')
const groupModuleIds = new Set(collectAllFlowModuleIdsFromModules(modules))
const groups = validateFlowGroups(flow.groups, groupModuleIds)
const notes = validateFlowNotes(flow.notes, groupModuleIds)
if (preprocessorModule) {
if (preprocessorModule.id !== SPECIAL_MODULE_IDS.PREPROCESSOR) {
throw new Error(
`Invalid preprocessor_module: id must be "${SPECIAL_MODULE_IDS.PREPROCESSOR}"`
)
}
if (
preprocessorModule.value.type !== 'rawscript' &&
preprocessorModule.value.type !== 'script'
) {
throw new Error(
'Invalid preprocessor_module: only "rawscript" and "script" modules are supported'
)
}
}
if (failureModule) {
if (failureModule.id !== SPECIAL_MODULE_IDS.FAILURE) {
throw new Error(`Invalid failure_module: id must be "${SPECIAL_MODULE_IDS.FAILURE}"`)
}
if (failureModule.value.type !== 'rawscript' && failureModule.value.type !== 'script') {
throw new Error('Invalid failure_module: only "rawscript" and "script" modules are supported')
}
}
const ids = new Set(collectAllFlowModuleIdsFromModules(modules))
if (preprocessorModule) {
if (ids.has(preprocessorModule.id)) {
throw new Error(`Duplicate module ID found in preprocessor_module: ${preprocessorModule.id}`)
}View on GitHub (pinned to e474e8803c)
Solutions
- Replace the preprocessor_module value with a rawscript or script value (type, content/code, language set).
- Move non-script module types into the regular modules list instead.
- Re-run the tool after converting the module.
Example fix
// before
{"preprocessor_module":{"id":"preprocessor","value":{"type":"aiagent",...}}}
// after
{"preprocessor_module":{"id":"preprocessor","value":{"type":"rawscript","language":"python3","content":"..."}}} Defensive patterns
Strategy: validation
Validate before calling
const t = flow.preprocessor_module?.value?.type
if (t && t !== 'rawscript' && t !== 'script')
throw new Error(`preprocessor_module type must be rawscript|script, got ${t}`) Type guard
function isScriptValue(v) {
return v?.type === 'rawscript' || v?.type === 'script'
} Try / catch
try {
validateEditableFlowJson(raw)
} catch (e) {
if (String(e.message).includes('preprocessor_module: only')) {
// replace the value with a rawscript/script module or move it to modules
} else throw e
} Prevention
- Reserve preprocessor_module for rawscript/script code only
- Place agents, subflows and other module types in the regular modules list
- Check value.type before assigning any module to the preprocessor slot
When it happens
Trigger: Calling flowTools modules/patches with preprocessor_module set to a module whose value.type is e.g. "aiagent", "flow", or "identity" while the id is correct.
Common situations: An LLM wires an AI agent or subflow as a preprocessor; a regular module is pasted into preprocessor_module without changing its type; template misuse.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Invalid ${fieldName}: ${error?.message ?? 'unknown error'}
- Invalid preprocessor_module: id must be "${SPECIAL_MODULE_ID
- Invalid failure_module: id must be "${SPECIAL_MODULE_IDS.FAI
- result.substring(__RESULT_ERR_PREFIX.length)
- Invalid migration name '${name}': use only letters, digits,
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/4e626a11ab30dd40.
Report an issue: GitHub.