{"record":{"id":"0274ed18a3543ee3","repo":"windmill-labs/windmill","slug":"module-args-module-id-is-not-an-inline-rawscr","errorCode":null,"errorMessage":"Module \"${args.module_id}\" is not an inline rawscript in flow \"${args.path}\". (Path runnables, branches, and loops have no inline script content; use patch_flow_json to inspect them.)","messagePattern":"Module \"(.+?)\" is not an inline rawscript in flow \"(.+?)\"\\. \\(Path runnables, branches, and loops have no inline script content; use patch_flow_json to inspect them\\.\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":5287,"sourceCode":"\t\t\tfailure_module: newFlowValue.failure_module ?? null\n\t\t}) + formatAiAgentProviderWarnings(aiProviderWarnings)\n\t)\n}\n\nasync function readFlowModuleCode(\n\targs: { path: string; module_id: string },\n\tctx: WriteDraftCtx\n): Promise<string> {\n\tconst { workspace, toolId, toolCallbacks } = ctx\n\ttoolCallbacks.setToolStatus(toolId, {\n\t\tcontent: `Reading inline script for module \"${args.module_id}\" from flow \"${args.path}\"...`\n\t})\n\tconst base = await loadFlowDraftValue(args.path, workspace)\n\tconst session = createInlineScriptSession()\n\tbuildEditableFlowJson(flowDraftAsEditableInput(base.flow), session)\n\tconst content = session.get(args.module_id)\n\tif (content === undefined) {\n\t\tthrow new Error(\n\t\t\t`Module \"${args.module_id}\" is not an inline rawscript in flow \"${args.path}\". (Path runnables, branches, and loops have no inline script content; use patch_flow_json to inspect them.)`\n\t\t)\n\t}\n\ttoolCallbacks.setToolStatus(toolId, {\n\t\tcontent: `Read inline script for \"${args.module_id}\"`\n\t})\n\treturn content\n}\n\nasync function setFlowModuleCode(\n\targs: { path: string; module_id: string; code: string },\n\tctx: WriteDraftCtx\n): Promise<string> {\n\tconst { workspace, toolId, toolCallbacks } = ctx\n\ttoolCallbacks.setToolStatus(toolId, {\n\t\tcontent: `Updating inline script for module \"${args.module_id}\" in flow \"${args.path}\"...`\n\t})\n\tconst base = await loadFlowDraftValue(args.path, workspace)","sourceCodeStart":5269,"sourceCodeEnd":5305,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L5269-L5305","documentation":"The read-inline-script tool only serves modules that are inline rawscripts in the flow's editable JSON. If the session built from the flow draft has no content entry for the requested module_id, the module is something else (path runnable, branch, loop) or does not exist, and the tool throws with guidance to inspect it via patch_flow_json instead.","triggerScenarios":"Calling read_inline_script (readInlineScript flow tool) with args.module_id not present in the inline-script session built via buildEditableFlowJson for flow args.path.","commonSituations":"The module_id belongs to a path runnable/script reference rather than an inline rawscript; the id is from a different flow or an older draft; the module is a flow-level node (branch/loop/foreach) that has no inline code.","solutions":["Use patch_flow_json to inspect the flow structure and confirm the module's id and type.","If it is a path runnable, read the underlying script by its path instead.","Verify the module_id against the current flow draft/deployed flow, not a stale listing."],"exampleFix":"// before\nreadInlineScript({ path: 'f/x', module_id: 'loop1' }) // loop has no inline script\n// after\npatchFlowJson({ path: 'f/x', read: true }) // inspect structure first","handlingStrategy":"validation","validationCode":"// inspect structure first to confirm the module is an inline rawscript\nconst { flow } = await inspectFlowJson(args.path)\nconst mod = findModule(flow, args.module_id)\nif (!mod || mod.type !== 'rawscript' || typeof mod.content !== 'string') {\n  // use patch_flow_json / read the referenced script instead\n}","typeGuard":"function isInlineRawscript(mod: FlowModule | undefined): boolean {\n  return !!mod && mod.type === 'rawscript' && typeof (mod.value as any)?.content === 'string'\n}","tryCatchPattern":"try {\n  return await readInlineScript(args)\n} catch (e) {\n  if (e.message.includes('not an inline rawscript')) {\n    return patchFlowJson({ path: args.path, read: true })\n  }\n  throw e\n}","preventionTips":["Confirm module ids and types via patch_flow_json before reading inline code.","Read path-referenced scripts via ScriptService, not the inline reader.","Branches, loops and foreach nodes have no inline code — do not target them."],"tags":["flows","modules","validation"],"backgroundTag":"module-not-inline-script","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"}