{"record":{"id":"5f4e0d894dc8e38f","repo":"windmill-labs/windmill","slug":"node-detail-id-not-found","errorCode":null,"errorMessage":"Node ${detail.id} not found","messagePattern":"Node (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/flows/map/FlowModuleSchemaMap.svelte","lineNumber":937,"sourceCode":"\t\t\t\tclone.id = copyId(original.id, flowStateStore.val, flowStore.val)\n\t\t\t\tflowStateStore.val[clone.id] = emptyFlowModuleState()\n\n\t\t\t\tdfs([clone], (mod) => {\n\t\t\t\t\tif (mod.id !== clone.id) {\n\t\t\t\t\t\tconst newModId = nextId(flowStateStore.val, flowStore.val)\n\t\t\t\t\t\tmod.id = newModId\n\t\t\t\t\t\tflowStateStore.val[newModId] = emptyFlowModuleState()\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\ttargetModules.splice(targetIndex + 1, 0, clone)\n\t\t\t\trefreshFlowStateStore(flowStore)\n\t\t\t\tselectionManager.selectId(clone.id, { openPanel: true })\n\t\t\t}}\n\t\t\tonUpdateMock={(detail) => {\n\t\t\t\tlet module = findModuleById(detail.id)\n\t\t\t\tif (!module) {\n\t\t\t\t\tthrow new Error(`Node ${detail.id} not found`)\n\t\t\t\t}\n\t\t\t\tmodule.mock = $state.snapshot(detail.mock)\n\t\t\t\trefreshFlowStateStore(flowStore)\n\t\t\t}}\n\t\t\t{onTestFlow}\n\t\t\t{isRunning}\n\t\t\t{onCancelTestFlow}\n\t\t\t{onOpenPreview}\n\t\t\t{onHideJobStatus}\n\t\t\t{controlsPosition}\n\t\t\texitNoteMode={() => (noteMode = false)}\n\t\t\tonNotePositionUpdate={(noteId, position) => {\n\t\t\t\t// Update note position via NoteEditor context in edit mode\n\t\t\t\tif (noteEditorContext?.noteEditor) {\n\t\t\t\t\tnoteEditorContext.noteEditor.updatePosition(noteId, position)\n\t\t\t\t}\n\t\t\t}}\n\t\t\tmultiSelectEnabled","sourceCodeStart":919,"sourceCodeEnd":955,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/flows/map/FlowModuleSchemaMap.svelte#L919-L955","documentation":"In FlowModuleSchemaMap.svelte, the onUpdateMock handler receives an id from the map UI and looks up the corresponding flow module via findModuleById. If no module with that id exists in the flow, it throws 'Node ${id} not found'. This guards against stale or foreign node ids being applied to the flow store.","triggerScenarios":"Dispatching an update-mock event with a detail.id that no longer exists in the flow — e.g. the module was deleted in another tab/user session, the flow was reloaded and ids changed, or a stale selection was used.","commonSituations":"Two users editing the same flow concurrently (one deletes a module while another edits its mock); the schema map kept a cached node id across a flow reload; ids differ between draft and saved flow versions.","solutions":["Reload the flow/schema map so node ids match the current flow, then retry the mock update","Verify the module id exists in the current flow (check value.modules in the YAML or the editor)","Avoid editing mocks on a stale tab — refresh before continuing concurrent edits","If it recurs, check for flow version mismatches (unsaved local copy vs server version)"],"exampleFix":"// before\nonUpdateMock={(detail) => {\n  const module = findModuleById(detail.id)\n  module.mock = detail.mock\n}}\n// after\nonUpdateMock={(detail) => {\n  const module = findModuleById(detail.id)\n  if (!module) {\n    sendUserToast('Module no longer exists — reloading flow', true)\n    return\n  }\n  module.mock = $state.snapshot(detail.mock)\n}}","handlingStrategy":"try-catch","validationCode":"const module = findModuleById(detail.id)\nif (!module) { console.warn('module gone, reloading flow'); await reloadFlow(); return }","typeGuard":"function moduleExists(id: string): boolean {\n  return flowStore.get().value.modules.some(m => m.id === id)\n}","tryCatchPattern":"try {\n  updateMock(detail)\n} catch (e) {\n  if (e.message.startsWith('Node ') && e.message.endsWith(' not found')) {\n    sendUserToast('Module no longer exists — refresh the flow', true)\n    await refreshFlow()\n  }\n}","preventionTips":["Refresh the flow after any external modification before editing mocks","Avoid multiple concurrent editors on the same flow","Re-read flow state after save/reload cycles instead of caching module ids","Handle delete events in the UI by clearing stale selections"],"tags":["state-sync","concurrency","ui"],"backgroundTag":"stale-reference-not-found","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"}