{"record":{"id":"6655ba27d93b2eec","repo":"n8n-io/n8n","slug":"no-nodes","errorCode":"NO_NODES","errorMessage":"Workflow has no nodes","messagePattern":"Workflow has no nodes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/no-nodes-validator.ts","lineNumber":28,"sourceCode":"/**\n * Validator that checks for empty workflows.\n *\n * Returns an error if the workflow has no nodes, since an empty workflow\n * cannot perform any operations.\n */\nexport const noNodesValidator: ValidatorPlugin = {\n\tid: 'core:no-nodes',\n\tname: 'No Nodes Validator',\n\tpriority: 100, // High priority - should run early\n\n\t// Per-node validation not used - we do workflow-level validation\n\tvalidateNode: (): ValidationIssue[] => [],\n\n\tvalidateWorkflow(ctx: PluginContext): ValidationIssue[] {\n\t\tif (ctx.nodes.size === 0) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tcode: 'NO_NODES',\n\t\t\t\t\tmessage: 'Workflow has no nodes',\n\t\t\t\t\tseverity: 'error',\n\t\t\t\t\tviolationLevel: 'critical',\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\treturn [];\n\t},\n};\n","sourceCodeStart":10,"sourceCodeEnd":38,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/no-nodes-validator.ts#L10-L38","documentation":"Error \"Workflow has no nodes\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/no-nodes-validator.ts:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}