windmill-labs/windmill · error · Error

Module "${args.module_id}" is not an inline rawscript in flo

Error message

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.)

What it means

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.

Source

Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:5287

			failure_module: newFlowValue.failure_module ?? null
		}) + formatAiAgentProviderWarnings(aiProviderWarnings)
	)
}

async function readFlowModuleCode(
	args: { path: string; module_id: string },
	ctx: WriteDraftCtx
): Promise<string> {
	const { workspace, toolId, toolCallbacks } = ctx
	toolCallbacks.setToolStatus(toolId, {
		content: `Reading inline script for module "${args.module_id}" from flow "${args.path}"...`
	})
	const base = await loadFlowDraftValue(args.path, workspace)
	const session = createInlineScriptSession()
	buildEditableFlowJson(flowDraftAsEditableInput(base.flow), session)
	const content = session.get(args.module_id)
	if (content === undefined) {
		throw new Error(
			`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.)`
		)
	}
	toolCallbacks.setToolStatus(toolId, {
		content: `Read inline script for "${args.module_id}"`
	})
	return content
}

async function setFlowModuleCode(
	args: { path: string; module_id: string; code: string },
	ctx: WriteDraftCtx
): Promise<string> {
	const { workspace, toolId, toolCallbacks } = ctx
	toolCallbacks.setToolStatus(toolId, {
		content: `Updating inline script for module "${args.module_id}" in flow "${args.path}"...`
	})
	const base = await loadFlowDraftValue(args.path, workspace)

View on GitHub (pinned to e474e8803c)

Solutions

  1. Use patch_flow_json to inspect the flow structure and confirm the module's id and type.
  2. If it is a path runnable, read the underlying script by its path instead.
  3. Verify the module_id against the current flow draft/deployed flow, not a stale listing.

Example fix

// before
readInlineScript({ path: 'f/x', module_id: 'loop1' }) // loop has no inline script
// after
patchFlowJson({ path: 'f/x', read: true }) // inspect structure first
Defensive patterns

Strategy: validation

Validate before calling

// inspect structure first to confirm the module is an inline rawscript
const { flow } = await inspectFlowJson(args.path)
const mod = findModule(flow, args.module_id)
if (!mod || mod.type !== 'rawscript' || typeof mod.content !== 'string') {
  // use patch_flow_json / read the referenced script instead
}

Type guard

function isInlineRawscript(mod: FlowModule | undefined): boolean {
  return !!mod && mod.type === 'rawscript' && typeof (mod.value as any)?.content === 'string'
}

Try / catch

try {
  return await readInlineScript(args)
} catch (e) {
  if (e.message.includes('not an inline rawscript')) {
    return patchFlowJson({ path: args.path, read: true })
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/0274ed18a3543ee3. Report an issue: GitHub.