{"record":{"id":"35b2f1d6319496b0","repo":"windmill-labs/windmill","slug":"module-args-module-id-is-not-an-inline-rawscr-35b2f1","errorCode":null,"errorMessage":"Module \"${args.module_id}\" is not an inline rawscript in flow \"${args.path}\". Use patch_flow_json or write_flow for structural changes.","messagePattern":"Module \"(.+?)\" is not an inline rawscript in flow \"(.+?)\"\\. Use patch_flow_json or write_flow for structural changes\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":5309,"sourceCode":"\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)\n\tconst session = createInlineScriptSession()\n\tconst editable = buildEditableFlowJson(flowDraftAsEditableInput(base.flow), session)\n\tif (!session.has(args.module_id)) {\n\t\tthrow new Error(\n\t\t\t`Module \"${args.module_id}\" is not an inline rawscript in flow \"${args.path}\". Use patch_flow_json or write_flow for structural changes.`\n\t\t)\n\t}\n\tsession.set(args.module_id, args.code)\n\tconst newFlowValue = applyEditableFlowJsonToFlow(base.flow.value, editable, session)\n\treturn writeFlowDraft(\n\t\t{\n\t\t\tpath: args.path,\n\t\t\tsummary: base.summary,\n\t\t\tflow: { ...base.flow, value: newFlowValue }\n\t\t},\n\t\tctx\n\t)\n}\n\nfunction normalizeTestRunArgs(args: Record<string, any> | null | undefined): Record<string, any> {\n\treturn args ?? {}\n}","sourceCodeStart":5291,"sourceCodeEnd":5327,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L5291-L5327","documentation":"The write-inline-script tool can only replace code of an existing inline rawscript module. If the inline-script session built from the flow draft has no entry for the given module_id, the tool refuses — it cannot create new modules — and points to patch_flow_json or write_flow for structural changes.","triggerScenarios":"Calling the update-inline-script flow tool with args.module_id where session.has(module_id) is false: the id is not an inline rawscript in flow args.path.","commonSituations":"Trying to 'add' a step by writing code for a not-yet-existing module id; targeting a path runnable, branch or loop node; a typo'd or stale module id after the flow was restructured.","solutions":["Use patch_flow_json to add the module structurally first, then update its code inline.","Use write_flow to rewrite the flow including the new/changed module.","If the module is a path runnable, edit the referenced script instead of the flow module."],"exampleFix":"// before\nwriteInlineScript({ path: 'f/x', module_id: 'new_step', code: '...' }) // module does not exist\n// after\npatchFlowJson({ path: 'f/x', addModule: { id: 'new_step', type: 'rawscript', ... } })\nwriteInlineScript({ path: 'f/x', module_id: 'new_step', code: '...' })","handlingStrategy":"validation","validationCode":"const session = peekInlineScriptSession(args.path) // or inspect flow JSON\nif (!session?.has(args.module_id)) {\n  await patchFlowJson({ path: args.path, addModule: { id: args.module_id, type: 'rawscript' } })\n}","typeGuard":"function canEditInline(flow: FlowValue, moduleId: string): boolean {\n  const m = findModule(flow, moduleId)\n  return !!m && m.type === 'rawscript' && typeof (m.value as any)?.content === 'string'\n}","tryCatchPattern":"try {\n  await writeInlineScript(args)\n} catch (e) {\n  if (e.message.includes('not an inline rawscript')) {\n    await writeFlow({ ...flowIncluding(args.module_id) }) // structural change first\n  } else throw e\n}","preventionTips":["Inline-script updates are edit-only: add modules structurally first.","Never invent module ids — take them from patch_flow_json output.","For path runnables, edit the underlying script instead."],"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"}