{"record":{"id":"3d283f2ab3c0cab2","repo":"n8n-io/n8n","slug":"agent-no-system-message","errorCode":"AGENT_NO_SYSTEM_MESSAGE","errorMessage":"'${node.name}' has no system message. System-level instructions should be in the system message field.","messagePattern":"'(.+?)' has no system message\\. System-level instructions should be in the system message field\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/agent-validator.ts","lineNumber":67,"sourceCode":"\t\t// (MISSING_EXPRESSION_PREFIX will handle malformed expressions)\n\t\tif (!text || (!hasValidExpression && !hasMalformedExpression)) {\n\t\t\tissues.push({\n\t\t\t\tcode: 'AGENT_STATIC_PROMPT',\n\t\t\t\tmessage: `Is input data required for '${node.name}'? If so, add an expression to the prompt. When following a chat trigger node, use { promptType: 'auto', text: '={{ $json.chatInput }}' }. Or use { promptType: 'define', text: '={{ ... }}' } to add dynamic data like input data.`,\n\t\t\t\tseverity: 'warning',\n\t\t\t\tnodeName: node.name,\n\t\t\t});\n\t\t}\n\n\t\t// Check: No system message\n\t\tconst options = params.options as Record<string, unknown> | undefined;\n\t\tconst systemMessage = options?.systemMessage ?? params.systemMessage;\n\t\tif (\n\t\t\t!systemMessage ||\n\t\t\t(typeof systemMessage === 'string' && systemMessage.trim().length === 0)\n\t\t) {\n\t\t\tissues.push({\n\t\t\t\tcode: 'AGENT_NO_SYSTEM_MESSAGE',\n\t\t\t\tmessage: `'${node.name}' has no system message. System-level instructions should be in the system message field.`,\n\t\t\t\tseverity: 'warning',\n\t\t\t\tnodeName: node.name,\n\t\t\t});\n\t\t}\n\n\t\treturn issues;\n\t},\n};\n","sourceCodeStart":49,"sourceCodeEnd":77,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/workflow-builder/plugins/validators/agent-validator.ts#L49-L77","documentation":"Warning-level validator issue (code AGENT_NO_SYSTEM_MESSAGE) emitted when an Agent node has no system message — neither options.systemMessage nor params.systemMessage is set, or it is an empty/whitespace string. Without a system message the agent lacks system-level instructions, which usually leads to inconsistent behavior.","triggerScenarios":"Building an agent node and omitting systemMessage entirely, or passing systemMessage: '' / a blank string.","commonSituations":"Minimal agent setup that only fills the user prompt; migrating a config where the system message key was renamed or dropped.","solutions":["Add options.systemMessage (or top-level systemMessage) with the agent's role/instructions.","Ensure the value is a non-empty, non-whitespace string.","If intentionally omitted, accept the warning or suppress it via validator configuration."],"exampleFix":"// before\nagent({ text: '={{ $json.chatInput }}' })\n// after\nagent({\n  text: '={{ $json.chatInput }}',\n  systemMessage: 'You are a helpful assistant that summarizes text.'\n})","handlingStrategy":"validation","validationCode":"function hasSystemMessage(p: { systemMessage?: unknown; options?: { systemMessage?: unknown } }): boolean {\n  const sm = p.options?.systemMessage ?? p.systemMessage;\n  return typeof sm === 'string' && sm.trim().length > 0;\n}\nif (!hasSystemMessage(agentParams)) {\n  // warn: missing system message\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set a non-empty systemMessage on agent nodes.","Keep agent role/instructions in the system message, not the user prompt.","Validate agent config before exporting a workflow."],"tags":["agent","validator","system-message","ai"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}