{"record":{"id":"170e0db7bf0c1656","repo":"n8n-io/n8n","slug":"404","errorCode":"404","errorMessage":"Cannot find workflow","messagePattern":"Cannot find workflow","errorType":"http","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"packages/cli/src/chat/chat-execution-manager.ts","lineNumber":180,"sourceCode":"\t\t// the `main` channel instead of `ai_tool`, so the agent never sees the approval\n\t\t// and the gated tool is never executed. The webhook resume path keys off the\n\t\t// same `HitlTool` suffix.\n\t\tconst resumingNode = runExecutionData.executionData!.nodeExecutionStack[0].node;\n\t\tif (resumingNode.type === CHAT_TOOL_NODE_TYPE || isHitlToolType(resumingNode.type)) {\n\t\t\trunExecutionData.waitTill = undefined;\n\t\t\tresumingNode.disabled = true;\n\t\t\tresumingNode.rewireOutputLogTo = NodeConnectionTypes.AiTool;\n\n\t\t\tconst lastNodeExecuted = runExecutionData.resultData.lastNodeExecuted as string;\n\t\t\tconst runDataArray = runExecutionData.resultData.runData[lastNodeExecuted];\n\t\t\tif (runDataArray?.length) preserveInputOverride(runDataArray);\n\t\t}\n\n\t\tlet project: Project | undefined = undefined;\n\t\ttry {\n\t\t\tproject = await this.ownershipService.getWorkflowProjectCached(workflowData.id);\n\t\t} catch (error) {\n\t\t\tthrow new NotFoundError('Cannot find workflow');\n\t\t}\n\n\t\tconst runData: IWorkflowExecutionDataProcess = {\n\t\t\texecutionMode,\n\t\t\texecutionData: runExecutionData,\n\t\t\tpushRef: runExecutionData.pushRef,\n\t\t\tworkflowData,\n\t\t\tpinData: runExecutionData.resultData.pinData,\n\t\t\tprojectId: project?.id,\n\t\t};\n\n\t\treturn runData;\n\t}\n}\n","sourceCodeStart":162,"sourceCodeEnd":195,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/cli/src/chat/chat-execution-manager.ts#L162-L195","documentation":"ChatExecutionManager.getRunData throws NotFoundError (404) 'Cannot find workflow' when ownershipService.getWorkflowProjectCached(workflowData.id) throws — i.e. the workflow referenced by a chat execution no longer resolves to a project (deleted, inaccessible, or not yet imported).","triggerScenarios":"A chat trigger resumes an execution whose workflowData.id has no project mapping (workflow deleted, or running against a not-yet-saved workflow id). The try/catch converts any error from the ownership lookup into NotFoundError.","commonSituations":"Workflow was deleted between the chat execution starting and resuming; chat triggered against a temp/unsaved workflow; cross-project access where the user lost access to the workflow's project.","solutions":["Recreate or re-import the workflow and retry the chat execution.","Ensure the chat trigger runs against a saved, owned workflow id.","Grant the executing user access to the workflow's project."],"exampleFix":"n/a","handlingStrategy":"try-catch","validationCode":"// Before resuming, confirm the workflow still has a project\nlet project;\ntry { project = await ownershipService.getWorkflowProjectCached(workflowId); }\ncatch { /* workflow missing: surface not-found before resuming */ }","typeGuard":"function isNotFoundError(error: unknown): boolean {\n  return error instanceof Error && error.message === 'Cannot find workflow';\n}","tryCatchPattern":"try {\n  const runData = await chatExecutionManager.getRunData(execution, message);\n} catch (e) {\n  if (isNotFoundError(e)) { /* inform user the workflow was deleted/unavailable */ }\n  else throw e;\n}","preventionTips":["Run chat triggers only against saved, owned workflows.","Do not delete workflows that have live chat executions pending.","Validate workflow ownership before initiating chat resume."],"tags":["chat","workflow","not-found","http-404"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}