{"record":{"id":"b5b646848f0a53a3","repo":"iflytek/astron-agent","slug":"workflow-promptdebugger-nodedebugrequestfailed","errorCode":null,"errorMessage":"workflow.promptDebugger.nodeDebugRequestFailed","messagePattern":"workflow\\.promptDebugger\\.nodeDebugRequestFailed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"console/frontend/src/components/workflow/nodes/components/node-operation/index.tsx","lineNumber":158,"sourceCode":"    const execution = executeNodeDebugRequest({\n      workflowIdentity,\n      flushCurrentFlow,\n      isWorkflowCurrent: identity => {\n        const latestFlow = useFlowsManager.getState().currentFlow;\n        return (\n          currentWorkflowIdentityRef.current === identity &&\n          createWorkflowIdentity({ ...latestFlow, routeIdentity }) === identity\n        );\n      },\n      request: signal => {\n        const manager = useFlowsManager.getState();\n        const latestFlow = manager.currentFlow;\n        const latestNode = manager\n          .getCurrentStore()\n          .getState()\n          .nodes.find(node => node.id === id);\n        if (!latestNode) {\n          throw new Error(t('workflow.promptDebugger.nodeDebugRequestFailed'));\n        }\n        const requestNode = cloneDeep(\n          mergeNodeDebugRequest(latestNode, currentNode, debuggerNode)\n        );\n        return debugWorkflowNode(\n          id,\n          {\n            flowId: latestFlow?.flowId,\n            name: latestFlow?.name,\n            description: latestFlow?.description,\n            data: {\n              nodes: [requestNode],\n              edges: [],\n            },\n          },\n          signal\n        );\n      },","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/frontend/src/components/workflow/nodes/components/node-operation/index.tsx#L140-L176","documentation":"useNodeDebugger throws 'workflow.promptDebugger.nodeDebugRequestFailed' when the node to debug cannot be found in the current flow store: manager.getCurrentStore().getState().nodes.find(node => node.id === id) returns undefined, so the debug request is never built.","triggerScenarios":"handleNodeDebug/nodeDebugExect is invoked with an id that no longer exists in the flow store — the node was deleted, the id is stale from a cached callback, or the store was re-created (flow switched/reset) before the debug ran.","commonSituations":"Debugging a node after undo/delete, race between canvas re-render and async debug trigger, switching workflow versions while the debug panel is open.","solutions":["Confirm the node with the given id still exists on the canvas before triggering debug.","Close/reopen the debug panel to refresh the flow reference.","Check for stale closures holding an old node id; read the id from the live store at call time.","Verify manager.currentFlow points at the active workflow, not a stale one."],"exampleFix":"// before\nconst latestNode = manager.getCurrentStore().getState().nodes.find(node => node.id === id);\nif (!latestNode) { throw new Error(t('workflow.promptDebugger.nodeDebugRequestFailed')); }\n// after\nconst latestNode = manager.getCurrentStore().getState().nodes.find(node => node.id === id);\nif (!latestNode) {\n  console.warn('node not found in flow store', { id, nodeIds: manager.getCurrentStore().getState().nodes.map(n => n.id) });\n  throw new Error(t('workflow.promptDebugger.nodeDebugRequestFailed'));\n}","handlingStrategy":"type-guard","validationCode":"const node = manager.getCurrentStore().getState().nodes.find(n => n.id === id);\nif (!node) { message.warning('Node no longer exists'); return; }","typeGuard":"function nodeExists(nodes: Node[], id: string): nodes is Node[] & { find(n: Node): Node } {\n  return nodes.some(n => n.id === id);\n}","tryCatchPattern":"try {\n  await nodeDebugExect(id);\n} catch (e) {\n  if (e.message.includes('nodeDebugRequestFailed')) {\n    message.warning(t('workflow.promptDebugger.nodeDebugRequestFailed'));\n  } else { throw e; }\n}","preventionTips":["Read node ids from the live store at call time, never from stale closures.","Disable the debug action when the node is removed from the canvas.","Reset the debug panel state on flow/version switch."],"tags":["frontend","react","zustand","workflow","state"],"backgroundTag":"record-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}