windmill-labs/windmill · error
only scripts can be used as a input schema
Error message
only scripts can be used as a input schema
What it means
After locating the first module, getFirstStepSchema only supports extracting an input schema from script-like modules. If the first module's value.type is neither 'rawscript' nor 'script' (e.g., a flow input, loop, branch, or approval step), there is no script input schema to derive, so it throws.
Source
Thrown at frontend/src/lib/components/flows/flowStore.svelte.ts:57
sendUserToast('Only scripts can be used as a input schema', true)
return
}
sendUserToast('No first step found', true)
return
}
export async function getFirstStepSchema(flowState: FlowState, flow: OpenFlow) {
const firstModuleId = flow.value.modules[0]?.id
if (!firstModuleId || !flowState[firstModuleId]) {
throw new Error('no first step found')
}
const schema = $state.snapshot(flowState[firstModuleId].schema)
const v = flow.value.modules[0].value
if (v.type !== 'rawscript' && v.type !== 'script') {
throw new Error('only scripts can be used as a input schema')
}
const simplifiedModule = {
id: flow.value.modules[0].id,
summary: flow.value.modules[0].summary,
value: {
type: flow.value.modules[0].value.type,
...('path' in flow.value.modules[0].value ? { path: flow.value.modules[0].value.path } : {}),
...('language' in flow.value.modules[0].value
? { language: flow.value.modules[0].value.language }
: {})
}
}
return {
schema,
mod: simplifiedModule,
connectFirstNode: () => {View on GitHub (pinned to e474e8803c)
Solutions
- Verify the first module type before calling: only 'script' or 'rawscript' first steps are supported.
- Point the schema extraction at the first script-type module rather than strictly modules[0].
- Fall back to a manual/empty schema when the first step is not a script.
Example fix
// before const schema = await getFirstStepSchema(flowState, flow) // after const first = flow.value.modules[0]?.value if (first?.type !== 'rawscript' && first?.type !== 'script') return null const schema = await getFirstStepSchema(flowState, flow)
Defensive patterns
Strategy: type-guard
Validate before calling
const v = flow.value.modules[0]?.value const isScriptFirst = v?.type === 'rawscript' || v?.type === 'script'
Type guard
function firstModuleIsScript(flow: OpenFlow): boolean {
const v = flow.value.modules[0]?.value
return v?.type === 'rawscript' || v?.type === 'script'
} Try / catch
try {
const schema = await getFirstStepSchema(flowState, flow)
} catch (e) {
if (e.message.includes('input schema')) return buildEmptySchema()
throw e
} Prevention
- Locate the first script-type module instead of assuming modules[0].
- Re-derive schema targets after step reordering.
- Show schema UI only for script-first flows.
When it happens
Trigger: Calling getFirstStepSchema on a flow whose first module is a subflow, flow-input, loop, while-loop, branch, or any non-script module type.
Common situations: Reusing a schema-derivation helper built for script-first flows on flows that start with a control/IO step; reordering flow steps so a non-script module becomes first; AI-generated or templated flows with a leading flow-input module.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Can't create script from non-inline script
- no first step found
- Module not found or is not a rawscript
- PlanWriteRefusedError
- Failed to start test run - testFlow returned undefined
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/e812d3d2e7288e00.
Report an issue: GitHub.