{"record":{"id":"eef5e3dd47ad1d0d","repo":"windmill-labs/windmill","slug":"module-moduleid-not-found-this-module-either","errorCode":null,"errorMessage":"Module '${moduleId}' not found. This module either doesn't exist, isn't a rawscript, or wasn't replaced with a reference.","messagePattern":"Module '(.+?)' not found\\. This module either doesn't exist, isn't a rawscript, or wasn't replaced with a reference\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/flow/core.ts","lineNumber":496,"sourceCode":"\t{\n\t\tdef: inspectInlineScriptToolDef,\n\t\tplanModeSafe: true,\n\t\tfn: async ({ args, helpers, toolCallbacks, toolId }) => {\n\t\t\tconst parsedArgs = inspectInlineScriptSchema.parse(args)\n\t\t\tconst moduleId = parsedArgs.moduleId\n\n\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\tcontent: `Retrieving inline script content for module '${moduleId}'...`\n\t\t\t})\n\n\t\t\tconst content = helpers.inlineScriptSession.get(moduleId)\n\n\t\t\tif (content === undefined) {\n\t\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\t\tcontent: `Module '${moduleId}' not found in inline script store`,\n\t\t\t\t\terror: `No inline script found for module ID '${moduleId}'`\n\t\t\t\t})\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Module '${moduleId}' not found. This module either doesn't exist, isn't a rawscript, or wasn't replaced with a reference.`\n\t\t\t\t)\n\t\t\t}\n\n\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\tcontent: `Retrieved inline script for module '${moduleId}'`\n\t\t\t})\n\n\t\t\treturn JSON.stringify({\n\t\t\t\tmoduleId,\n\t\t\t\tcontent,\n\t\t\t\tnote: 'To modify this script, use the set_module_code tool with the new code'\n\t\t\t})\n\t\t}\n\t},\n\t{\n\t\tdef: setModuleCodeToolDef,\n\t\tstreamArguments: true,","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/flow/core.ts#L478-L514","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before: guessing an id\nawait inspectInlineScript({ moduleId: 'a1b2c3' })\n// after: confirm from live flow JSON first\nconst flowJson = buildEditableFlowJson(flow.value, session)\nconst mod = flowJson.modules.find((m) => m.id === 'a1b2c3')\nif (mod?.value?.type === 'rawscript') await inspectInlineScript({ moduleId: 'a1b2c3' })","handlingStrategy":"validation","validationCode":"const session = helpers.inlineScriptSession\nconst mod = currentFlowJson.modules.find((m) => m.id === moduleId)\nif (!mod || mod.value?.type !== 'rawscript') {\n  throw new Error(`${moduleId} is not an inline (rawscript) module in the current flow`)\n}","typeGuard":"function isInlineModule(m: FlowModule | undefined): boolean {\n  return !!m && m.value.type === 'rawscript'\n}","tryCatchPattern":"try {\n  const res = await inspectInlineScript({ moduleId })\n} catch (e) {\n  if (e.message.includes('not found')) {\n    refreshFlowJson() // re-sync module ids from the live flow\n  }\n}","preventionTips":["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"],"tags":["frontend","copilot","inline-script","module-not-found"],"backgroundTag":"module-id-not-found","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}