n8n-io/n8n · error · NodeOperationError

The ‘prompt’ parameter is empty.

Error message

The ‘prompt’ parameter is empty.

What it means

Thrown by the SQL Agent when the resolved prompt ('input' for v1.2, or getPromptInputByType for newer) is undefined. The label says 'prompt' rather than 'text', but the underlying condition is identical to 640/641. The getPromptInputByType helper throws 'No prompt specified' first for typeVersion > 1.2, so this message is primarily reachable on the legacy branch.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/SqlAgent/execute.ts:96

	const returnData: INodeExecutionData[] = [];

	for (let i = 0; i < items.length; i++) {
		try {
			const item = items[i];
			let input;
			if (this.getNode().typeVersion <= 1.2) {
				input = this.getNodeParameter('input', i) as string;
			} else {
				input = getPromptInputByType({
					ctx: this,
					i,
					inputKey: 'text',
					promptTypeKey: 'promptType',
				});
			}

			if (input === undefined) {
				throw new NodeOperationError(this.getNode(), 'The ‘prompt’ parameter is empty.');
			}

			const options = this.getNodeParameter('options', i, {}) as IDataObject & {
				tracingMetadata?: { values?: TracingMetadataEntry[] };
			};
			const selectedDataSource = this.getNodeParameter('dataSource', i, 'sqlite') as
				| 'mysql'
				| 'postgres'
				| 'sqlite';

			const includedSampleRows = options.includedSampleRows as number;
			const includedTablesArray = parseTablesString((options.includedTables as string) ?? '');
			const ignoredTablesArray = parseTablesString((options.ignoredTables as string) ?? '');

			let dataSource: DataSource | null = null;
			if (selectedDataSource === 'sqlite') {
				if (!item.binary) {
					throw new NodeOperationError(

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Set the prompt parameter to a non-empty natural-language question.
  2. Upgrade the SQL Agent node typeVersion to receive the more descriptive helper error.
  3. If the prompt is an expression, confirm the referenced upstream field exists.
Defensive patterns

Strategy: validation

Validate before calling

const raw = this.getNodeParameter('input', i, '') as string;
if (!raw || raw.trim() === '') {
  throw new NodeOperationError(this.getNode(), 'SQL prompt is empty — provide a natural-language question.');
}

Type guard

function hasPrompt(value: unknown): value is string {
  return typeof value === 'string' && value.trim().length > 0;
}

Try / catch

try {
  input = getPromptInputByType({ ctx: this, i, inputKey: 'text', promptTypeKey: 'promptType' });
} catch (e) {
  throw new NodeOperationError(this.getNode(), 'SQL prompt could not be resolved', { itemIndex: i, cause: e });
}

Prevention

When it happens

Trigger: SQL Agent with empty 'input' parameter (v1.2) or empty text/prompt parameter (newer); expression resolving to undefined.

Common situations: SQL Agent wired to a trigger whose output schema changed; user cleared the prompt field while configuring the data source.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/f2b5e3cc3fde7994. Report an issue: GitHub.