{"record":{"id":"2e6c14f9f02c83df","repo":"nocobase/nocobase","slug":"node-nodeid-not-found-in-workflow-this-e","errorCode":null,"errorMessage":"node (#${nodeId}) not found in workflow (#${this.execution.workflowId})","messagePattern":"node \\(#(.+?)\\) not found in workflow \\(#(.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/@nocobase/plugin-workflow/src/server/Processor.ts","lineNumber":380,"sourceCode":"      await this.prepare();\n      const { node, input, targetJob } = this.resolveRerun(options);\n      this.rerunContext = {\n        overwrite: options.overwrite === true,\n        targetJob,\n      };\n\n      return await this.run(node, input, { rerun: true });\n    } finally {\n      this.rerunContext = null;\n      this.leaveRunningState();\n    }\n  }\n\n  private getRerunNode(nodeId?: string | number) {\n    if (nodeId != null) {\n      const node = this.nodesMap.get(nodeId) || this.nodes.find((item) => String(item.id) === String(nodeId));\n      if (!node) {\n        throw new Error(`node (#${nodeId}) not found in workflow (#${this.execution.workflowId})`);\n      }\n      return node;\n    }\n\n    const head = this.nodes.find((item) => !item.upstream);\n    if (!head) {\n      throw new Error(`head node not found in workflow (#${this.execution.workflowId})`);\n    }\n    return head;\n  }\n\n  private getRerunInput(node: FlowNodeModel) {\n    if (!node.upstream) {\n      return { result: this.execution.context };\n    }\n\n    const upstreamJob = this.jobsMapByNodeKey[node.upstream.key];\n    if (!upstreamJob) {","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/nocobase/nocobase/blob/fa42722fefe44265490dff2c27d79e2882bce4fa/packages/plugins/@nocobase/plugin-workflow/src/server/Processor.ts#L362-L398","documentation":"getRerunNode resolves the node to rerun from nodesMap (by id) or by string-comparing ids across the workflow's nodes. If an explicit nodeId is supplied that no node in the execution's workflow matches, it throws rather than rerunning against an unknown node. Called by resolveRerun during processor.rerun.","triggerScenarios":"processor.rerun({ nodeId }) where nodeId is not in this.execution.workflow's nodes — id from a different workflow, stale id after the workflow was edited/node deleted, or passing a node key instead of a node id.","commonSituations":"Rerun requests built from outdated workflow snapshots; passing the key/UUID field where the numeric id is expected; workflow duplicated so ids differ between environments.","solutions":["Validate the nodeId belongs to execution.workflow.nodes before calling rerun (compare String(node.id) === String(nodeId)).","Pass the numeric node id, not the node key or title.","Refetch the workflow and its nodes to get current ids after edits.","If the node was deleted in a workflow revision, rerun from the head or a still-existing node."],"exampleFix":"// before\nawait processor.rerun({ nodeId: someKey });\n// after\nconst node = workflow.nodes.find((n) => String(n.id) === String(someKey));\nif (!node) {\n  throw new Error(`node ${someKey} does not exist in workflow ${workflow.id}`);\n}\nawait processor.rerun({ nodeId: node.id });","handlingStrategy":"validation","validationCode":"const nodes = await workflow.getNodes();\nconst node = nodes.find((n) => String(n.id) === String(nodeId));\nif (!node) {\n  throw new Error(`node ${nodeId} does not belong to workflow ${workflow.id}`);\n}","typeGuard":"function nodeBelongsToWorkflow(nodes: FlowNodeModel[], nodeId: string | number): node is FlowNodeModel {\n  return nodes.some((n) => String(n.id) === String(nodeId));\n}","tryCatchPattern":"try {\n  await processor.rerun({ nodeId });\n} catch (e) {\n  if (/not found in workflow \\(#/.test(e.message)) {\n    logger.error(`stale nodeId ${nodeId}; refresh workflow nodes before rerun`);\n    return null;\n  }\n  throw e;\n}","preventionTips":["Send numeric node id, never node key or title, in rerun requests.","Refetch workflow nodes after any workflow edit before issuing reruns.","Validate node membership server-side in your rerun endpoint.","Version workflow definitions and keep executions tied to their original node ids."],"tags":["workflow","rerun","node-lookup"],"backgroundTag":"workflow-node-not-found","analyzedSha":"fa42722fefe44265490dff2c27d79e2882bce4fa","analyzedAt":"2026-09-01T00:54:31.202Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}