windmill-labs/windmill · error
Module '${moduleId}' not found. This module either doesn't e
Error message
Module '${moduleId}' not found. This module either doesn't exist, isn't a rawscript, or wasn't replaced with a reference. What it means
The inspect_inline_script copilot tool looks up a module's inline script content in the in-memory inlineScriptSession store. When the store has no entry for the given moduleId, the tool throws this error explaining the three possible causes: the module doesn't exist, it isn't a rawscript (inline scripts are only stored for rawscript/bun/script-type inline code), or its code was extracted to a referenced script instead of kept inline.
Source
Thrown at frontend/src/lib/components/copilot/chat/flow/core.ts:496
{
def: inspectInlineScriptToolDef,
planModeSafe: true,
fn: async ({ args, helpers, toolCallbacks, toolId }) => {
const parsedArgs = inspectInlineScriptSchema.parse(args)
const moduleId = parsedArgs.moduleId
toolCallbacks.setToolStatus(toolId, {
content: `Retrieving inline script content for module '${moduleId}'...`
})
const content = helpers.inlineScriptSession.get(moduleId)
if (content === undefined) {
toolCallbacks.setToolStatus(toolId, {
content: `Module '${moduleId}' not found in inline script store`,
error: `No inline script found for module ID '${moduleId}'`
})
throw new Error(
`Module '${moduleId}' not found. This module either doesn't exist, isn't a rawscript, or wasn't replaced with a reference.`
)
}
toolCallbacks.setToolStatus(toolId, {
content: `Retrieved inline script for module '${moduleId}'`
})
return JSON.stringify({
moduleId,
content,
note: 'To modify this script, use the set_module_code tool with the new code'
})
}
},
{
def: setModuleCodeToolDef,
streamArguments: true,View on GitHub (pinned to e474e8803c)
Solutions
- Verify the moduleId exists in the current flow and is a rawscript/inline-script module (check via the flow JSON, not memory).
- If the module references an external script, inspect the script through the script-reference path instead of the inline store.
- Re-fetch the current flow JSON to get fresh, correct module IDs, then retry.
- If the code was recently replaced with a reference, view the referenced script directly in the script editor.
Example fix
// before: guessing an id
await inspectInlineScript({ moduleId: 'a1b2c3' })
// after: confirm from live flow JSON first
const flowJson = buildEditableFlowJson(flow.value, session)
const mod = flowJson.modules.find((m) => m.id === 'a1b2c3')
if (mod?.value?.type === 'rawscript') await inspectInlineScript({ moduleId: 'a1b2c3' }) Defensive patterns
Strategy: validation
Validate before calling
const session = helpers.inlineScriptSession
const mod = currentFlowJson.modules.find((m) => m.id === moduleId)
if (!mod || mod.value?.type !== 'rawscript') {
throw new Error(`${moduleId} is not an inline (rawscript) module in the current flow`)
} Type guard
function isInlineModule(m: FlowModule | undefined): boolean {
return !!m && m.value.type === 'rawscript'
} Try / catch
try {
const res = await inspectInlineScript({ moduleId })
} catch (e) {
if (e.message.includes('not found')) {
refreshFlowJson() // re-sync module ids from the live flow
}
} Prevention
- Take module IDs from the freshly fetched flow JSON, never from chat memory
- Remember referenced (non-inline) scripts are not in the inline store
- Rebuild the inline session after flow refactors that replace rawscripts with references
When it happens
Trigger: Calling inspect_inline_script with a moduleId that: is not present in the flow; is a script/flow-path module with no inline content; or whose code lives in a separate referenced script file, so nothing was stored under that ID in inlineScriptSession.
Common situations: The AI hallucinates or misremembers a module ID; the flow was refactored so the rawscript was replaced by a script reference; the chat session was restarted and the in-memory store was rebuilt from the current flow (inline content changed).
Related errors
- Failed to start test run - testFlow returned undefined
- No flow available to test step from. Please ensure you have
- OpenAI not initialized
- Anthropic not initialized
- Fixing frontend code is not supported
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/eef5e3dd47ad1d0d.
Report an issue: GitHub.