FlowiseAI/Flowise · error · Error
No datasource options provided
Error message
No datasource options provided
What it means
PostgresSaver.getDataSource destructures datasourceOptions from this.config and throws if falsy, before constructing a DataSource. Indicates the saver was built without connection options.
Source
Thrown at packages/components/nodes/memory/AgentMemory/PostgresAgentMemory/pgSaver.ts:37
this.threadId = threadId
}
sanitizeTableName(tableName: string): string {
// Trim and normalize case, turn whitespace into underscores
tableName = tableName.trim().toLowerCase().replace(/\s+/g, '_')
// Validate using a regex (alphanumeric and underscores only)
if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {
throw new Error('Invalid table name')
}
return tableName
}
private async getDataSource(): Promise<DataSource> {
const { datasourceOptions } = this.config
if (!datasourceOptions) {
throw new Error('No datasource options provided')
}
// Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app
if (datasourceOptions.port === 3006) {
throw new Error('Invalid port number')
}
const dataSource = new DataSource(datasourceOptions)
await dataSource.initialize()
return dataSource
}
private async setup(dataSource: DataSource): Promise<void> {
if (this.isSetup) {
return
}
try {
const queryRunner = dataSource.createQueryRunner()
const tableName = this.sanitizeTableName(this.tableName)View on GitHub (pinned to abe4a8601a)
Solutions
- Attach a Postgres credential to the Agent Memory node and fill host/db/user/password.
- Verify databaseType is postgres and additionalConfig resolves to connection options.
- Re-run the chatflow after saving the credential so datasourceOptions is populated.
Example fix
// before
new PostgresSaver({ threadId })
// after
new PostgresSaver({ threadId, datasourceOptions: { type:'postgres', host, port:5432, username, password, database } }) Defensive patterns
Strategy: validation
Validate before calling
function buildSaverConfig(threadId: string, opts?: Record<string, unknown>) {
if (!opts || Object.keys(opts).length === 0) throw new Error('datasourceOptions missing')
return { threadId, datasourceOptions: opts }
}
const saver = new PostgresSaver(buildSaverConfig(threadId, datasourceOptions)) Type guard
function hasDatasourceOptions(config: unknown): config is { datasourceOptions: Record<string, unknown> } {
return typeof config === 'object' && config !== null && Boolean((config as any).datasourceOptions)
} Try / catch
try {
await saver.getTuple(config)
} catch (e) {
if (/No datasource options/.test((e as Error).message)) {
// surface a credential/configuration error; do not retry
}
throw e
} Prevention
- Attach a Postgres credential to the Agent Memory node.
- Validate datasourceOptions is populated before constructing the saver.
- Fail fast at chatflow start if DB config is empty.
- Keep connection fields in a credential, not hardcoded.
When it happens
Trigger: PostgresAgentMemory.init produced a SaverOptions that did not include datasourceOptions (credential missing, connection fields empty, options not threaded).
Common situations: Credential component not selected on the memory node; connection fields left blank; chatflow run before the PG credential was saved; plumbing dropped the options object.
Related errors
- No datasource options provided
- Invalid JSON in the Additional Configuration:
- Invalid JSON in the Additional Configuration:
- Invalid JSON in the Additional Configuration:
- Invalid port number
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/174b26a07a0348c7.
Report an issue: GitHub.