n8n-io/n8n · error · NodeOperationError
No code for "Supply Data" set on node "${this.getNode().name
Error message
No code for "Supply Data" set on node "${this.getNode().name} What it means
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.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/code/Code.node.ts:475
for (const item of items as INodeExecutionData[]) {
standardizeOutput(item.json);
}
return [items as INodeExecutionData[]];
} else {
items.forEach((data) => {
for (const item of data as INodeExecutionData[]) {
standardizeOutput(item.json);
}
});
return items as INodeExecutionData[][];
}
}
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
const code = this.getNodeParameter('code', itemIndex) as { supplyData?: { code: string } };
if (!code.supplyData?.code) {
throw new NodeOperationError(
this.getNode(),
`No code for "Supply Data" set on node "${this.getNode().name}`,
{
itemIndex,
},
);
}
const sandbox = getSandbox.call(this, code.supplyData.code, { itemIndex });
const response = await sandbox.runCode<Tool>();
return {
response: logWrapper(response, this),
};
}
}
View on GitHub (pinned to 5ac6606e81)
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.
Example fix
// before
this.getNodeParameter('code', itemIndex) === { supplyData: { code: '' } }
// after
this.getNodeParameter('code', itemIndex) === { supplyData: { code: 'return $input.all();' } } Defensive patterns
Strategy: validation
Validate before calling
// Before calling supplyData, ensure the parameter is non-empty
const codeParam = this.getNodeParameter('code', itemIndex) as { supplyData?: { code?: string } };
if (!codeParam?.supplyData?.code?.trim()) {
// surface a UI-level warning or skip the node rather than throwing at runtime
throw new Error('Open the Code node and author the Supply Data function before executing.');
} Type guard
const hasSupplyDataCode = (
p: unknown,
): p is { supplyData: { code: string } } =>
typeof p === 'object' && p !== null &&
'supplyData' in p &&
typeof (p as any).supplyData?.code === 'string' &&
(p as any).supplyData.code.trim().length > 0; Try / catch
// Not applicable — pre-validate the parameter; runtime catch only re-surfaces the NodeOperationError.
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The ‘text‘ parameter is empty.
- The ‘text‘ parameter is empty.
- The ‘prompt’ parameter is empty.
- No binary data found, please connect a binary to the input i
- No data source found, please configure data source
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/39458bbf756b8b13.
Report an issue: GitHub.