{"record":{"id":"cca85745542b34e8","repo":"Zie619/n8n-workflows","slug":"input-text-is-empty-cca857","errorCode":null,"errorMessage":"Input text is empty","messagePattern":"Input text is empty","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"workflows/Splitout/1408_Splitout_Code_Monitor_Triggered.json","lineNumber":25,"sourceCode":"    \"owner\": \"n8n-user\",\n    \"license\": \"MIT\",\n    \"category\": \"automation\",\n    \"status\": \"active\",\n    \"priority\": \"high\",\n    \"environment\": \"production\"\n  },\n  \"nodes\": [\n    {\n      \"id\": \"cbc036f7-b0e1-4eb4-94c3-7571c67a1efe\",\n      \"name\": \"Code\",\n      \"type\": \"n8n-nodes-base.code\",\n      \"position\": [\n        -120,\n        40\n      ],\n      \"parameters\": {\n        \"mode\": \"runOnceForEachItem\",\n        \"jsCode\": \"// Get the input text\\nconst text = $input.item.json.text;\\n\\n// Ensure text is not null or undefined\\nif (!text) {\\n throw new Error('Input text is empty');\\n}\\n\\n// Function to split text into sentences while preserving dates and list items\\nfunction splitIntoSentences(text) {\\n const monthNames = '(?:Januar|Februar|März|April|Mai|Juni|Juli|August|September|Oktober|November|Dezember)';\\n const datePattern = `(?:\\\\\\\\d{1,2}\\\\\\\\.\\\\\\\\s*(?:${monthNames}|\\\\\\\\d{1,2}\\\\\\\\.)\\\\\\\\s*\\\\\\\\d{2,4})`;\\n \\n // Split by sentence-ending punctuation, but not within dates or list items\\n const regex = new RegExp(`(?<=[.!?])\\\\\\\\s+(?=[A-ZÄÖÜ]|$)(?!${datePattern}|\\\\\\\\s*[-•]\\\\\\\\s)`, 'g');\\n \\n return text.split(regex)\\n .map(sentence => sentence.trim())\\n .filter(sentence => sentence !== '');\\n}\\n\\n// Split the text into sentences\\nconst sentences = splitIntoSentences(text);\\n\\n// Output a single object with an array of sentences\\nreturn { json: { sentences: sentences } };\"\n      },\n      \"typeVersion\": 2,\n      \"notes\": \"This code node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"faae4740-a529-4275-be0e-b079c3bfde58\",\n      \"name\": \"Split Out1\",\n      \"type\": \"n8n-nodes-base.splitOut\",\n      \"position\": [\n        340,\n        -180\n      ],\n      \"parameters\": {\n        \"options\": {\n          \"destinationFieldName\": \"claim\"\n        },\n        \"fieldToSplitOut\": \"sentences\"\n      },","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Splitout/1408_Splitout_Code_Monitor_Triggered.json#L7-L43","documentation":"Same per-item sentence-splitter Code node as error 95, replicated in workflow 1408. Runs in runOnceForEachItem mode and throws 'Input text is empty' whenever $input.item.json.text is undefined, null, or '' for the current item — one bad item stops the execution.","triggerScenarios":"An incoming item lacks the text field: content delivered under another key by the trigger, a previous node dropping the field, or a genuinely empty document. Whitespace-only text passes the falsy check but yields an empty sentences array downstream.","commonSituations":"Trigger type changed (webhook vs manual vs file) with different output keys; mapping expressions referencing a renamed field; empty pages/sections in the input batch; the workflow copied from 0725 into 1408 without updating field names.","solutions":["Inspect the item's json keys and map the real text field (see exampleFix).","Trim and skip empty items instead of throwing.","Put a Filter node in front to drop empty-text items.","Add .trim() to the check so whitespace-only input is treated as empty."],"exampleFix":"// before\nconst text = $input.item.json.text;\nif (!text) {\n throw new Error('Input text is empty');\n}\n\n// after\nconst text = String($input.item.json.text ?? '').trim();\nif (!text) {\n  return { json: { sentences: [] } };\n}","handlingStrategy":"validation","validationCode":"const text = String($input.item.json.text ?? '').trim();\nif (!text) {\n  return { json: { sentences: [] } }; // skip empty item instead of failing the run\n}","typeGuard":"function isNonEmptyTextItem(item) {\n  return typeof item?.json?.text === 'string' && item.json.text.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Filter empty-text items before the loop; per-item throws abort entire executions.","Use String(x ?? '') coercion so undefined fields cannot throw earlier than your guard.","When cloning workflows between triggers, re-check the field name each clone expects."],"tags":["n8n","text-processing","empty-input","runonceforeachitem","field-mapping"],"backgroundTag":null,"analyzedSha":"94007c1445d9258a7da116646b79473e7c7c3282","analyzedAt":"2026-08-15T04:10:37.591Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}