windmill-labs/windmill · error · Error

path is required when runnable type is "script", "flow", or

Error message

path is required when runnable type is "script", "flow", or "hubscript".

What it means

The path-based runnable branch (type "script", "flow", or "hubscript") requires a `path` pointing at the referenced runnable. When none of those types carry a path, core.ts throws this error. It is the mirror of error 366 for the by-path variants.

Source

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

	if (input.type === 'inline') {
		if (!input.inlineScript) {
			throw new Error('inlineScript is required when runnable type is "inline".')
		}
		return {
			...carried,
			name: input.name,
			type: 'inline',
			inlineScript: {
				content: input.inlineScript.content,
				language: input.inlineScript.language
			},
			fields
		}
	}

	if (!input.path) {
		throw new Error('path is required when runnable type is "script", "flow", or "hubscript".')
	}
	return {
		...carried,
		name: input.name,
		type: 'path',
		runType: input.type,
		path: input.path,
		fields,
		schema: sameTarget ? (existing?.schema ?? {}) : {}
	}
}

type AppFrontendFileMetadata = {
	path: string
	size: number
}

type AppBackendRunnableMetadata = {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Add the path of the target script/flow/hub script, e.g. path: 'u/admin/my_script'.
  2. If no path exists yet, use type "inline" with inlineScript content instead.
  3. Confirm the referenced item exists with a workspace-item search/list before referencing it.
  4. Guard the input: only choose a path-based type when a non-empty path string is available.

Example fix

// before
runnable({ type: 'script', name: 'transform' })
// after
runnable({ type: 'script', name: 'transform', path: 'u/admin/transform' })
Defensive patterns

Strategy: validation

Validate before calling

if (['script', 'flow', 'hubscript'].includes(input.type) && !input.path) {
  throw new Error(`path required for type ${input.type}`)
}

Type guard

function hasPath(i: RunnableInput): i is RunnableInput & { path: string } {
  return i.type === 'inline' || typeof (i as any).path === 'string' && (i as any).path.length > 0
}

Try / catch

try {
  await createRunnable(input)
} catch (e) {
  if (e.message.includes('path is required')) {
    const found = await findWorkspaceItem(input.type, input.name)
    await createRunnable({ ...input, path: found.path })
  }
}

Prevention

When it happens

Trigger: Calling the runnable tool with { type: 'script', name: 'x' } and no path, or with path set to empty string/null; copying a runType without carrying the path field over.

Common situations: The AI omits path when switching from an inline runnable to a by-path one; the path variable is undefined because a lookup step failed; a typo leaves path undefined while runType is set.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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