windmill-labs/windmill · error
No flow available to test. Please ensure you have a flow ope
Error message
No flow available to test. Please ensure you have a flow open in the editor.
What it means
The flow test tool throws when no flow (or flow.value) is present in the current editor context, meaning there is nothing to execute a test run against. It sets a tool status ('No flow available to test' / 'No flow found in current context') and raises so the model receives a failure result.
Source
Thrown at frontend/src/lib/components/copilot/chat/flow/core.ts:412
allowResourcesFetch: true
})
toolCallbacks.setToolStatus(toolId, {
content: 'Retrieved instructions for code generation in ' + parsedArgs.language
})
return langContext
}
},
{
def: testRunFlowToolDef,
fn: async function ({ args, workspace, helpers, toolCallbacks, toolId }) {
const { flow } = helpers.getFlowAndSelectedId()
if (!flow || !flow.value) {
toolCallbacks.setToolStatus(toolId, {
content: 'No flow available to test',
error: 'No flow found in current context'
})
throw new Error(
'No flow available to test. Please ensure you have a flow open in the editor.'
)
}
const parsedArgs = await buildTestRunArgs(args, this.def)
// Use the UI test mechanism - this opens the preview panel
return executeTestRun({
jobStarter: async () => {
const jobId = await helpers.testFlow(parsedArgs)
if (!jobId) {
throw new Error('Failed to start test run - testFlow returned undefined')
}
return jobId
},
workspace,
toolCallbacks,
toolId,
startMessage: 'Starting flow test run...',View on GitHub (pinned to e474e8803c)
Solutions
- Open a flow in the editor (or attach the AI session to one) before calling the test tool.
- Wait for the flow editor to finish loading and re-issue the tool call.
- Create a new flow first if none exists, then run the test.
Example fix
// before
await tools.testFlow({})
// after
const flow = getCurrentEditorFlow()
if (!flow?.value) {
return toolCallbacks.report('No flow open — open a flow in the editor first.')
}
await tools.testFlow({}) Defensive patterns
Strategy: type-guard
Validate before calling
const flow = getEditorContext()?.flow
if (!flow?.value) {
toolCallbacks.setToolStatus(toolId, { content: 'No flow open', error: 'Open a flow first' })
return
} Type guard
function hasTestableFlow(ctx: EditorContext | undefined): ctx is EditorContext & { flow: { value: FlowValue } } {
return ctx?.flow?.value != null
} Try / catch
try {
await tools.testFlow(args)
} catch (e) {
if (e.message.includes('No flow available to test')) {
return promptUserToOpenFlow()
}
throw e
} Prevention
- Only enable/expose the test-flow tool when an open flow editor is attached to the session.
- Verify editor context (flow and flow.value) is loaded before issuing test calls.
- Re-attach session context after page reloads before running editor-dependent tools.
When it happens
Trigger: Calling the test-flow tool when the copilot session is not attached to an open flow editor, the editor has no flow loaded yet, or flow.value is empty/undefined at call time.
Common situations: User invokes 'test the flow' from an AI session opened on a script or app rather than a flow; the flow editor is still loading; the session context was lost after a page reload.
Related errors
- not a flow
- Cannot push flow ${remotePath}: missing inline script file(s
- Cannot push flow ${remotePath}: step(s) reference non-worksp
- Flow ${flowPath} not found
- Refusing to extract corrupted inline script for module '${id
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/18ba28172f2ee40a.
Report an issue: GitHub.