{"record":{"id":"0386dfe6694239e2","repo":"windmill-labs/windmill","slug":"could-not-find-the-selected-id-in-the-flow-0386df","errorCode":null,"errorMessage":"Could not find the selected id in the flow","messagePattern":"Could not find the selected id in the flow","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/StepInputsGen.svelte","lineNumber":56,"sourceCode":"\n\tlet generatedContent = ''\n\tlet parsedInputs: string[][] = []\n\tlet newFlowInputs: string[] = $state([])\n\n\tlet abortController = $state(new AbortController())\n\tasync function generateStepInputs() {\n\t\tif (Object.keys($generatedExprs || {}).length > 0 || loading) {\n\t\t\treturn\n\t\t}\n\t\tlogStepInputFill('all')\n\t\tabortController = new AbortController()\n\t\tloading = true\n\t\tstepInputsLoading?.set(true)\n\t\tconst flow: Flow = JSON.parse(JSON.stringify(flowStore.val))\n\t\tconst idOrders = dfs(flow.value.modules, (x) => x.id)\n\t\tconst upToIndex = idOrders.indexOf(selectionManager.getSelectedId())\n\t\tif (upToIndex === -1) {\n\t\t\tthrow new Error('Could not find the selected id in the flow')\n\t\t}\n\t\tconst flowDetails =\n\t\t\t'Take into account the following information for never tested results:\\n<flowDetails>\\n' +\n\t\t\tyamlStringifyExceptKeys(sliceModules(flow.value.modules, upToIndex, idOrders), ['lock']) +\n\t\t\t'</flowDetails>'\n\n\t\ttry {\n\t\t\tconst availableData = {\n\t\t\t\tresults: pickableProperties?.priorIds,\n\t\t\t\tflow_input: pickableProperties?.flow_input\n\t\t\t}\n\t\t\tconst isInsideLoop = availableData.flow_input && 'iter' in availableData.flow_input\n\t\t\tconst user = `I'm building a workflow which is a DAG of script steps.\nThe current step is ${selectionManager.getSelectedId()}, you can find the details for the step and previous ones below:\n${flowDetails}\n\nDetermine for all the inputs \"${argNames.join(\n\t\t\t\t'\", \"'","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/StepInputsGen.svelte#L38-L74","documentation":"StepInputsGen.svelte's generateStepInputs() performs the identical selection check: if the selected id is not found in the DFS order of flow.value.modules, it throws 'Could not find the selected id in the flow' before building AI context.","triggerScenarios":"Batch step-inputs AI generation triggered while the selected id is absent from the current flow module tree.","commonSituations":"Selection lost after editor tab switch; flow edited/deleted steps in another pane; selecting a virtual node (flow input/output) rather than a module.","solutions":["Re-select the step in the flow editor and retry","Sync the editor with the saved flow (reload) if ids changed","Confirm the target is a flow module visible in the editor tree"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"const idOrders = dfs(flowStore.val.value.modules, (x) => x.id)\nif (!idOrders.includes(selectionManager.getSelectedId())) {\n  console.warn('Selection not found in flow; re-select a step')\n  return\n}","typeGuard":"function selectionInFlow(flow: Flow, selectedId: string | undefined): boolean {\n  return !!selectedId && dfs(flow.value.modules, (x) => x.id).includes(selectedId)\n}","tryCatchPattern":"try {\n  await generateStepInputs()\n} catch (e) {\n  if (e.message === 'Could not find the selected id in the flow') {\n    console.warn('Re-select a flow step and retry step-inputs generation')\n  } else throw e\n}","preventionTips":["Re-select the step before batch-generating inputs","Sync editor state with the saved flow to avoid stale ids","Select only modules visible in the flow editor tree"],"tags":["copilot","flow-editor","stale-selection"],"backgroundTag":"selected-node-not-in-flow","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"}