windmill-labs/windmill · error

No flow available to test step from. Please ensure you have

Error message

No flow available to test step from. Please ensure you have a flow open in the editor.

What it means

The 'test step' copilot tool needs the currently open flow (helpers.getFlowAndSelectedId()) to locate the step it should run. If no flow, or a flow without a value, is present in the editor context, the tool reports the status via toolCallbacks and throws this error. The library throws it because running a single step is impossible without a flow document to resolve the step from.

Source

Thrown at frontend/src/lib/components/copilot/chat/flow/core.ts:456

			})
		},
		requiresConfirmation: true,
		confirmationMessage: 'Run a test of the current flow',
		showDetails: true,
		autoCollapseDetails: false
	},
	{
		// set strict to false to avoid issues with open ai models
		def: testRunStepToolDef,
		fn: async ({ args, workspace, helpers, toolCallbacks, toolId }) => {
			const { flow } = helpers.getFlowAndSelectedId()

			if (!flow || !flow.value) {
				toolCallbacks.setToolStatus(toolId, {
					content: 'No flow available to test step from',
					error: 'No flow found in current context'
				})
				throw new Error(
					'No flow available to test step from. Please ensure you have a flow open in the editor.'
				)
			}

			const stepId = args.stepId
			const stepArgs = args.args || {}

			return executeFlowStepTestRun({
				flowValue: flow.value,
				stepId,
				args: stepArgs,
				workspace,
				toolCallbacks,
				toolId
			})
		},
		requiresConfirmation: true,
		confirmationMessage: (args) => `Run a test of step "${args?.stepId ?? ''}"`,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Open a flow in the flow editor and wait for it to fully load before running the step-test tool.
  2. Confirm the copilot chat is instantiated in a flow-editor context where helpers.getFlowAndSelectedId() is bound.
  3. Retry after the editor hydrates; if it persists, check that the flow store is not resetting on navigation.

Example fix

// guard before invoking the tool
const { flow } = helpers.getFlowAndSelectedId()
if (!flow?.value) {
  notifyUser('Open a flow in the editor before testing a step')
  return
}
Defensive patterns

Strategy: type-guard

Validate before calling

const { flow } = helpers.getFlowAndSelectedId()
if (!flow?.value) {
  notifyUser('Open a flow in the editor first')
  return
}

Type guard

function hasOpenFlow(h: FlowAIChatHelpers): boolean {
  const { flow } = h.getFlowAndSelectedId()
  return !!flow && !!flow.value
}

Try / catch

try {
  await runStepTest({ stepId, args })
} catch (e) {
  if (e.message.includes('No flow available')) notifyUser('Open a flow in the editor, then retry')
  else throw e
}

Prevention

When it happens

Trigger: Invoking the test_run_step tool while no flow is open in the editor, or when getFlowAndSelectedId() returns { flow: undefined } / flow.value is null (editor not loaded, wrong page, flow still loading).

Common situations: User asks the AI to test a step while on a non-flow page or before the flow editor finishes loading; the copilot chat runs in a context (e.g. script editor, app editor) that has no flow store bound.

Related errors


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