windmill-labs/windmill · error

Can't create script from non-inline script

Error message

Can't create script from non-inline script

What it means

createScriptFromInlineScript forks a flow module's inline (rawscript) code into a standalone script. It only works when flowModule.value.type is 'rawscript'; if the module references a pre-existing script (type 'script') or another resource, there is no inline code to fork, so the function throws immediately after reading the user store.

Source

Thrown at frontend/src/lib/components/flows/flowStateUtils.svelte.ts:288

	return {
		id: nextId(flowState, fullFlow),
		value: { type: 'identity', flow }
	}
}

export async function createScriptFromInlineScript(
	flowModule: FlowModule,
	suffix: string,
	schema: Schema | undefined,
	flowPath: string,
	// The session's acting workspace when the flow editor runs in an AI session;
	// falls back to the navigation workspace outside a session.
	workspace?: string
): Promise<[FlowModule & { value: PathScript }, FlowModuleState]> {
	const user = get(userStore)

	if (flowModule.value.type != 'rawscript') {
		throw new Error("Can't create script from non-inline script")
	}

	const originalScriptPath = flowModule.value.path
	const wasForked = Boolean(originalScriptPath)

	if (wasForked && originalScriptPath) {
		const [_first, _second, ...others] = originalScriptPath.split('/')
		suffix = others.join('/')
	}

	const path = `${flowPath}/${suffix}`
	const forkedDescription = wasForked ? `as a fork of ${originalScriptPath}` : ''
	const description = `This script was edited in place of flow ${flowPath} ${forkedDescription} by ${user?.username}.`

	const availablePath = await findNextAvailablePath(path, workspace)

	const hash = await ScriptService.createScript({
		workspace: workspace ?? get(workspaceStore)!,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check flowModule.value.type === 'rawscript' before calling; route 'script' modules to a different edit flow (navigate to the script itself or fork via the script editor).
  2. If you need to fork a path-referenced script, fetch the script content by its path and create a rawscript module first, then call this function.
  3. Filter flow.value.modules to rawscript-only entries when batch-forking steps.

Example fix

// before
const [newModule, state] = await createScriptFromInlineScript(flowModule)
// after
if (flowModule.value.type !== 'rawscript') {
  goto(`/scripts/get/${flowModule.value.path}`)
} else {
  const [newModule, state] = await createScriptFromInlineScript(flowModule)
}
Defensive patterns

Strategy: validation

Validate before calling

function canFork(flowModule: FlowModule): boolean {
  return flowModule.value.type === 'rawscript'
}

Type guard

function isRawscriptModule(m: FlowModule): m is FlowModule & { value: { type: 'rawscript' } } {
  return m.value.type === 'rawscript'
}

Try / catch

try {
  await createScriptFromInlineScript(flowModule)
} catch (e) {
  if (e.message.includes("non-inline script")) {
    toast.error('This step references a saved script; open the script to edit it.')
  } else throw e
}

Prevention

When it happens

Trigger: Calling createScriptFromInlineScript(flowModule, ...) with a module whose value.type is 'script' (path-referenced script), 'hubscript', or any non-'rawscript' type.

Common situations: User clicks 'fork/edit as standalone script' on a flow step that was added from the hub or already references a saved script path; programmatic flow manipulation that iterates all modules without filtering by type; stale UI state where a module was converted from inline to path-referenced.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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