{"record":{"id":"460b9c8be235b8f8","repo":"windmill-labs/windmill","slug":"no-flow-available-to-test-step-from-please-ensure","errorCode":null,"errorMessage":"No flow available to test step from. Please ensure you have a flow open in the editor.","messagePattern":"No flow available to test step from\\. Please ensure you have a flow open in the editor\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/flow/core.ts","lineNumber":456,"sourceCode":"\t\t\t})\n\t\t},\n\t\trequiresConfirmation: true,\n\t\tconfirmationMessage: 'Run a test of the current flow',\n\t\tshowDetails: true,\n\t\tautoCollapseDetails: false\n\t},\n\t{\n\t\t// set strict to false to avoid issues with open ai models\n\t\tdef: testRunStepToolDef,\n\t\tfn: async ({ args, workspace, helpers, toolCallbacks, toolId }) => {\n\t\t\tconst { flow } = helpers.getFlowAndSelectedId()\n\n\t\t\tif (!flow || !flow.value) {\n\t\t\t\ttoolCallbacks.setToolStatus(toolId, {\n\t\t\t\t\tcontent: 'No flow available to test step from',\n\t\t\t\t\terror: 'No flow found in current context'\n\t\t\t\t})\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'No flow available to test step from. Please ensure you have a flow open in the editor.'\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst stepId = args.stepId\n\t\t\tconst stepArgs = args.args || {}\n\n\t\t\treturn executeFlowStepTestRun({\n\t\t\t\tflowValue: flow.value,\n\t\t\t\tstepId,\n\t\t\t\targs: stepArgs,\n\t\t\t\tworkspace,\n\t\t\t\ttoolCallbacks,\n\t\t\t\ttoolId\n\t\t\t})\n\t\t},\n\t\trequiresConfirmation: true,\n\t\tconfirmationMessage: (args) => `Run a test of step \"${args?.stepId ?? ''}\"`,","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/flow/core.ts#L438-L474","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Open a flow in the flow editor and wait for it to fully load before running the step-test tool.","Confirm the copilot chat is instantiated in a flow-editor context where helpers.getFlowAndSelectedId() is bound.","Retry after the editor hydrates; if it persists, check that the flow store is not resetting on navigation."],"exampleFix":"// guard before invoking the tool\nconst { flow } = helpers.getFlowAndSelectedId()\nif (!flow?.value) {\n  notifyUser('Open a flow in the editor before testing a step')\n  return\n}","handlingStrategy":"type-guard","validationCode":"const { flow } = helpers.getFlowAndSelectedId()\nif (!flow?.value) {\n  notifyUser('Open a flow in the editor first')\n  return\n}","typeGuard":"function hasOpenFlow(h: FlowAIChatHelpers): boolean {\n  const { flow } = h.getFlowAndSelectedId()\n  return !!flow && !!flow.value\n}","tryCatchPattern":"try {\n  await runStepTest({ stepId, args })\n} catch (e) {\n  if (e.message.includes('No flow available')) notifyUser('Open a flow in the editor, then retry')\n  else throw e\n}","preventionTips":["Confirm the copilot is bound to a flow-editor context before enabling step-test tools","Wait for the flow store to hydrate before allowing test tools","Surface a UI hint when the user asks to test a step with no flow open"],"tags":["frontend","copilot","flow-editor","missing-context"],"backgroundTag":"flow-not-open","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}