{"record":{"id":"149ed868475af814","repo":"n8n-io/n8n","slug":"no-sentiment-categories-provided","errorCode":null,"errorMessage":"No sentiment categories provided","messagePattern":"No sentiment categories provided","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.ts","lineNumber":338,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Sequential Processing\n\t\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst sentimentCategories = this.getNodeParameter(\n\t\t\t\t\t\t'options.categories',\n\t\t\t\t\t\ti,\n\t\t\t\t\t\tDEFAULT_CATEGORIES,\n\t\t\t\t\t) as string;\n\n\t\t\t\t\tconst categories = sentimentCategories\n\t\t\t\t\t\t.split(',')\n\t\t\t\t\t\t.map((cat) => cat.trim())\n\t\t\t\t\t\t.filter(Boolean);\n\n\t\t\t\t\tif (categories.length === 0) {\n\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'No sentiment categories provided', {\n\t\t\t\t\t\t\titemIndex: i,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Initialize returnData with empty arrays for each category\n\t\t\t\t\tif (returnData.length === 0) {\n\t\t\t\t\t\treturnData.push(...Array.from({ length: categories.length }, () => []));\n\t\t\t\t\t}\n\n\t\t\t\t\tconst options = this.getNodeParameter('options', i, {}) as {\n\t\t\t\t\t\tsystemPromptTemplate?: string;\n\t\t\t\t\t\tincludeDetailedResults?: boolean;\n\t\t\t\t\t\tenableAutoFixing?: boolean;\n\t\t\t\t\t};\n\n\t\t\t\t\tconst schema = z.object({\n\t\t\t\t\t\tsentiment: z.enum(categories as [string, ...string[]]),\n\t\t\t\t\t\tstrength: z","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/chains/SentimentAnalysis/SentimentAnalysis.node.ts#L320-L356","documentation":"Thrown by the Sentiment Analysis node when the 'options.categories' parameter, after splitting on commas and filtering empties, yields zero categories. The node needs at least one sentiment label to classify against, so an empty list halts execution.","triggerScenarios":"The categories option is blank, contains only commas/whitespace, or every token is empty after trimming. The filter(Boolean) removes all entries, leaving categories.length === 0.","commonSituations":"User cleared the categories field; the field contains only separators; the default (DEFAULT_CATEGORIES) was somehow overridden with an empty string via an expression or environment template.","solutions":["Set 'Categories' under the node options to a comma-separated list like 'positive,negative,neutral'.","If using an expression for categories, ensure it resolves to a non-empty comma-separated string.","Remove the override so the default categories apply, or restore DEFAULT_CATEGORIES."],"exampleFix":"// before\nconst categories = sentimentCategories.split(',').map((cat) => cat.trim()).filter(Boolean);\nif (categories.length === 0) {\n  throw new NodeOperationError(this.getNode(), 'No sentiment categories provided', { itemIndex: i });\n}\n\n// after — fall back to defaults and warn instead of hard-failing\nlet categories = sentimentCategories.split(',').map((cat) => cat.trim()).filter(Boolean);\nif (categories.length === 0) {\n  categories = DEFAULT_CATEGORIES.split(',').map((c) => c.trim()).filter(Boolean);\n}","handlingStrategy":"validation","validationCode":"const raw = ctx.getNodeParameter('options.categories', i, DEFAULT_CATEGORIES) as string;\nconst categories = raw.split(',').map((c) => c.trim()).filter(Boolean);\nif (categories.length === 0) {\n  throw new Error('Provide at least one sentiment category (e.g. positive,negative,neutral)');\n}","typeGuard":"function hasCategories(raw: string): boolean {\n  return raw.split(',').map((c) => c.trim()).filter(Boolean).length > 0;\n}","tryCatchPattern":null,"preventionTips":["Set Categories to a non-empty comma-separated list.","Avoid blank-only or comma-only values.","Remove custom overrides to fall back to DEFAULT_CATEGORIES."],"tags":["configuration","parameter-validation","sentiment-analysis"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}