windmill-labs/windmill · error · Error

Invalid hub flow path: ${path}

Error message

Invalid hub flow path: ${path}

What it means

loadSchema resolves the JSON schema for a script/flow being edited. For a flow whose path points at the Hub (isHubFlowPath true), it extracts the hub flow id from the path; if the path looks like a hub flow path but the id cannot be parsed out of it, it throws `Invalid hub flow path: <path>`. This is a malformed-path guard before calling FlowService.getHubFlowById.

Source

Thrown at frontend/src/lib/infer.ts:654

}

export async function loadSchema(
	workspace: string,
	path: string,
	runType: 'script' | 'flow' | 'hubscript'
): Promise<{ schema: Schema; summary: string | undefined }> {
	if (runType === 'script') {
		const script = await ScriptService.getScriptByPath({
			workspace,
			path
		})

		return { schema: script.schema as any, summary: script.summary }
	} else if (runType === 'flow') {
		if (isHubFlowPath(path)) {
			const hubFlowId = getHubFlowIdFromPath(path)
			if (hubFlowId === undefined) {
				throw new Error(`Invalid hub flow path: ${path}`)
			}
			const hub = await FlowService.getHubFlowById({ id: hubFlowId })
			const flow = hub.flow
			const schema =
				flow?.schema && typeof flow.schema === 'object' && Object.keys(flow.schema).length > 0
					? (flow.schema as any)
					: emptySchema()
			return { schema, summary: flow?.summary }
		}

		const flow = await FlowService.getFlowByPath({
			workspace,
			path
		})

		return { schema: flow.schema as any, summary: flow.summary }
	} else {
		const script = await ScriptService.getHubScriptByPath({

View on GitHub (pinned to e474e8803c)

Solutions

  1. Inspect the printed path — it must contain a valid hub flow id where getHubFlowIdFromPath expects it.
  2. Re-select the hub flow from the Hub picker instead of typing the path by hand.
  3. Use the standard path format produced by the UI (e.g. `hub/<numeric-id>`) with no extra segments.
  4. Clear the stale path and browse the hub to get a fresh link.

Example fix

// before
path = 'hub/https://hub.windmill.dev/flows/12/my_flow' // whole URL, id unparseable
// after
path = 'hub/12/my_flow' // id-parseable hub path
Defensive patterns

Strategy: validation

Validate before calling

function validHubFlowPath(path: string): boolean {
  if (!isHubFlowPath(path)) return true // not a hub path, other handling applies
  return getHubFlowIdFromPath(path) !== undefined
}
if (!validHubFlowPath(path)) throw new Error(`pick the hub flow from the Hub UI: '${path}'`)

Type guard

function isParseableHubFlowPath(p: string): boolean {
  return isHubFlowPath(p) && Number.isFinite(getHubFlowIdFromPath(p))
}

Try / catch

try {
  const schema = await loadSchema(path, runType)
} catch (e) {
  if (e.message.startsWith('Invalid hub flow path')) openHubPicker()
  else throw e
}

Prevention

When it happens

Trigger: loadSchema with runType 'flow' and a hub-style path (e.g. `hub/<id>` or similar pattern) whose id segment is empty, non-numeric, or doesn't match the expected getHubFlowIdFromPath pattern (e.g. `hub/` with no id, or a hand-typed path).

Common situations: Typing or pasting a hub flow URL/path manually into the path field with extra segments or missing the id; a stale bookmark to a removed hub flow format; constructing paths programmatically with an undefined id.

Related errors


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