{"record":{"id":"39458bbf756b8b13","repo":"n8n-io/n8n","slug":"no-code-for-supply-data-set-on-node-this-getn","errorCode":null,"errorMessage":"No code for \"Supply Data\" set on node \"${this.getNode().name}","messagePattern":"No code for \"Supply Data\" set on node \"(.+?)","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/code/Code.node.ts","lineNumber":475,"sourceCode":"\t\t\tfor (const item of items as INodeExecutionData[]) {\n\t\t\t\tstandardizeOutput(item.json);\n\t\t\t}\n\t\t\treturn [items as INodeExecutionData[]];\n\t\t} else {\n\t\t\titems.forEach((data) => {\n\t\t\t\tfor (const item of data as INodeExecutionData[]) {\n\t\t\t\t\tstandardizeOutput(item.json);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn items as INodeExecutionData[][];\n\t\t}\n\t}\n\n\tasync supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {\n\t\tconst code = this.getNodeParameter('code', itemIndex) as { supplyData?: { code: string } };\n\n\t\tif (!code.supplyData?.code) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`No code for \"Supply Data\" set on node \"${this.getNode().name}`,\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst sandbox = getSandbox.call(this, code.supplyData.code, { itemIndex });\n\t\tconst response = await sandbox.runCode<Tool>();\n\n\t\treturn {\n\t\t\tresponse: logWrapper(response, this),\n\t\t};\n\t}\n}\n","sourceCodeStart":457,"sourceCodeEnd":492,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts#L457-L492","documentation":"Thrown by the Code node's supplyData() method when the node is configured in 'Supply Data' mode but the user has not entered any JavaScript code in the supplyData.code parameter. The node reads the 'code' parameter expecting an object with a supplyData.code string; if that string is absent or empty, it cannot build a sandbox or run anything, so execution halts with a NodeOperationError tagged with the offending itemIndex.","triggerScenarios":"The Code node parameter 'code' resolves to an object whose supplyData.code property is undefined, null, or empty string. This happens when the node's mode is set to 'Run Once for Each Item' / 'Run Once for All Items' alternate 'Supply Data' but the code editor was left blank or the parameter JSON was hand-edited to omit the code field.","commonSituations":"Switching a Code node into 'Supply Data' mode in an AI workflow (LangChain tool/passthrough) and forgetting to author the supplyData function; importing a workflow JSON where the code field was stripped; UI bug or stale draft where the editor shows content but the saved parameter is empty.","solutions":["Open the Code node, confirm the mode selector is on 'Supply Data', and write valid JavaScript in the code editor (e.g. return $input.all();).","If importing a workflow, verify the JSON's parameters.code.supplyData.code is a non-empty string before activating.","Pin the node typeVersion and re-open in the latest n8n UI so the parameter path 'code.supplyData.code' matches what supplyData() reads."],"exampleFix":"// before\nthis.getNodeParameter('code', itemIndex) === { supplyData: { code: '' } }\n// after\nthis.getNodeParameter('code', itemIndex) === { supplyData: { code: 'return $input.all();' } }","handlingStrategy":"validation","validationCode":"// Before calling supplyData, ensure the parameter is non-empty\nconst codeParam = this.getNodeParameter('code', itemIndex) as { supplyData?: { code?: string } };\nif (!codeParam?.supplyData?.code?.trim()) {\n  // surface a UI-level warning or skip the node rather than throwing at runtime\n  throw new Error('Open the Code node and author the Supply Data function before executing.');\n}","typeGuard":"const hasSupplyDataCode = (\n  p: unknown,\n): p is { supplyData: { code: string } } =>\n  typeof p === 'object' && p !== null &&\n  'supplyData' in p &&\n  typeof (p as any).supplyData?.code === 'string' &&\n  (p as any).supplyData.code.trim().length > 0;","tryCatchPattern":"// Not applicable — pre-validate the parameter; runtime catch only re-surfaces the NodeOperationError.","preventionTips":["Author and save the Code node's supplyData function before activating the workflow.","Use workflow JSON validation on import to assert parameters.code.supplyData.code is a non-empty string.","Add a CI lint pass that scans for Code nodes in Supply Data mode missing the code field."],"tags":["code-node","langchain","configuration","user-input"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}