{"record":{"id":"ea95e1df2c62cdeb","repo":"n8n-io/n8n","slug":"no-data-source-found-please-configure-data-source","errorCode":null,"errorMessage":"No data source found, please configure data source","messagePattern":"No data source found, please configure data source","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/SqlAgent/execute.ts","lineNumber":133,"sourceCode":"\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t'No binary data found, please connect a binary to the input if you want to use SQLite as data source',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst binaryPropertyName = this.getNodeParameter('binaryPropertyName', i, 'data');\n\t\t\t\tdataSource = await getSqliteDataSource.call(this, item.binary, binaryPropertyName);\n\t\t\t}\n\n\t\t\tif (selectedDataSource === 'postgres') {\n\t\t\t\tdataSource = await getPostgresDataSource.call(this);\n\t\t\t}\n\n\t\t\tif (selectedDataSource === 'mysql') {\n\t\t\t\tdataSource = await getMysqlDataSource.call(this);\n\t\t\t}\n\n\t\t\tif (!dataSource) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t'No data source found, please configure data source',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst agentOptions: SqlCreatePromptArgs = {\n\t\t\t\ttopK: (options.topK as number) ?? 10,\n\t\t\t\tprefix: (options.prefixPrompt as string) ?? SQL_PREFIX,\n\t\t\t\tsuffix: (options.suffixPrompt as string) ?? SQL_SUFFIX,\n\t\t\t\tinputVariables: ['chatHistory', 'input', 'agent_scratchpad'],\n\t\t\t};\n\n\t\t\tconst dbInstance = await SqlDatabase.fromDataSourceParams({\n\t\t\t\tappDataSource: dataSource,\n\t\t\t\tincludesTables: includedTablesArray.length > 0 ? includedTablesArray : undefined,\n\t\t\t\tignoreTables: ignoredTablesArray.length > 0 ? ignoredTablesArray : undefined,\n\t\t\t\tsampleRowsInTableInfo: includedSampleRows ?? 3,\n\t\t\t});","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/SqlAgent/execute.ts#L115-L151","documentation":"Thrown by the SQL Agent when none of the dataSource branches (sqlite/postgres/mysql) produced a non-null DataSource. This indicates an unhandled dataSource value or a connection loader silently returning null — effectively a configuration/contract violation.","triggerScenarios":"dataSource parameter set to a value other than 'sqlite' | 'postgres' | 'mysql'; or one of getSqliteDataSource/getPostgresDataSource/getMysqlDataSource returning null without throwing.","commonSituations":"Workflow JSON was hand-edited and dataSource holds an invalid enum value; a credential loader returned null due to a missing or malformed credential; a future dataSource option was added to the UI but not wired into execute.ts.","solutions":["Re-open the SQL Agent node and re-select the Data Source dropdown (resets the parameter to a valid enum value).","Verify the matching credential (Postgres / MySQL) is selected and valid.","If using SQLite, ensure binary data is present (see error 643)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const dataSource = this.getNodeParameter('dataSource', i, '') as string;\nif (!['sqlite', 'postgres', 'mysql'].includes(dataSource)) {\n  throw new NodeOperationError(this.getNode(), `Unsupported data source '${dataSource}'. Use sqlite, postgres, or mysql.`);\n}","typeGuard":"function isDataSource(value: unknown): value is 'sqlite' | 'postgres' | 'mysql' {\n  return typeof value === 'string' && ['sqlite', 'postgres', 'mysql'].includes(value);\n}","tryCatchPattern":null,"preventionTips":["Always select the Data Source via the dropdown, not by editing workflow JSON by hand.","If hand-editing, validate the enum value before saving.","After import, re-open the node to reset parameters to valid values."],"tags":["langchain","agent","sql","configuration","data-source"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}