{"record":{"id":"f2b5e3cc3fde7994","repo":"n8n-io/n8n","slug":"the-prompt-parameter-is-empty","errorCode":null,"errorMessage":"The ‘prompt’ parameter is empty.","messagePattern":"The ‘prompt’ parameter is empty\\.","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/SqlAgent/execute.ts","lineNumber":96,"sourceCode":"\tconst returnData: INodeExecutionData[] = [];\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\ttry {\n\t\t\tconst item = items[i];\n\t\t\tlet input;\n\t\t\tif (this.getNode().typeVersion <= 1.2) {\n\t\t\t\tinput = this.getNodeParameter('input', i) as string;\n\t\t\t} else {\n\t\t\t\tinput = getPromptInputByType({\n\t\t\t\t\tctx: this,\n\t\t\t\t\ti,\n\t\t\t\t\tinputKey: 'text',\n\t\t\t\t\tpromptTypeKey: 'promptType',\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (input === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'The ‘prompt’ parameter is empty.');\n\t\t\t}\n\n\t\t\tconst options = this.getNodeParameter('options', i, {}) as IDataObject & {\n\t\t\t\ttracingMetadata?: { values?: TracingMetadataEntry[] };\n\t\t\t};\n\t\t\tconst selectedDataSource = this.getNodeParameter('dataSource', i, 'sqlite') as\n\t\t\t\t| 'mysql'\n\t\t\t\t| 'postgres'\n\t\t\t\t| 'sqlite';\n\n\t\t\tconst includedSampleRows = options.includedSampleRows as number;\n\t\t\tconst includedTablesArray = parseTablesString((options.includedTables as string) ?? '');\n\t\t\tconst ignoredTablesArray = parseTablesString((options.ignoredTables as string) ?? '');\n\n\t\t\tlet dataSource: DataSource | null = null;\n\t\t\tif (selectedDataSource === 'sqlite') {\n\t\t\t\tif (!item.binary) {\n\t\t\t\t\tthrow new NodeOperationError(","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/SqlAgent/execute.ts#L78-L114","documentation":"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.","triggerScenarios":"SQL Agent with empty 'input' parameter (v1.2) or empty text/prompt parameter (newer); expression resolving to undefined.","commonSituations":"SQL Agent wired to a trigger whose output schema changed; user cleared the prompt field while configuring the data source.","solutions":["Set the prompt parameter to a non-empty natural-language question.","Upgrade the SQL Agent node typeVersion to receive the more descriptive helper error.","If the prompt is an expression, confirm the referenced upstream field exists."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const raw = this.getNodeParameter('input', i, '') as string;\nif (!raw || raw.trim() === '') {\n  throw new NodeOperationError(this.getNode(), 'SQL prompt is empty — provide a natural-language question.');\n}","typeGuard":"function hasPrompt(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0;\n}","tryCatchPattern":"try {\n  input = getPromptInputByType({ ctx: this, i, inputKey: 'text', promptTypeKey: 'promptType' });\n} catch (e) {\n  throw new NodeOperationError(this.getNode(), 'SQL prompt could not be resolved', { itemIndex: i, cause: e });\n}","preventionTips":["Default the prompt parameter to an example question.","Confirm upstream output schema if using an expression.","Upgrade SQL Agent typeVersion for the descriptive helper error."],"tags":["langchain","agent","prompt","configuration","sql"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}