FlowiseAI/Flowise · error · Error
No datasource options provided
Error message
No datasource options provided
What it means
MySQLSaver.getDataSource destructures datasourceOptions from this.config and throws immediately if falsy, before any DataSource is constructed. This indicates the saver was instantiated without connection configuration.
Source
Thrown at packages/components/nodes/memory/AgentMemory/MySQLAgentMemory/mysqlSaver.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 Postgres port, otherwise will throw uncaught error and crashing the app
if (datasourceOptions.port === 5432) {
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)
await queryRunner.manager.query(`
CREATE TABLE IF NOT EXISTS ${tableName} (View on GitHub (pinned to abe4a8601a)
Solutions
- Attach a MySQL credential to the Agent Memory node and fill host/db/user/password.
- Verify databaseType is set to mysql and the additionalConfig/object resolves to connection options.
- Re-run the chatflow after saving the credential so datasourceOptions is populated.
Example fix
// before
new MySQLSaver({ threadId })
// after
new MySQLSaver({ threadId, datasourceOptions: { type:'mysql', host, port:3306, 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 MySQLSaver(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 to the user
}
throw e
} Prevention
- Always attach a MySQL 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 DB connection fields in a credential, not hardcoded.
When it happens
Trigger: MySQLAgentMemory.init built a SaverOptions that did not include datasourceOptions (credential missing, databaseType not mysql, options not threaded through).
Common situations: Credential component not selected on the memory node; connection fields left empty; chatflow executed before the DB credential was saved; orgId/appDataSource plumbing dropped the options.
Related errors
- Invalid JSON in the Additional Configuration:
- Invalid port number
- No datasource options provided
- Invalid JSON in the Additional Configuration:
- Invalid table name
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/3febd24c1d5da688.
Report an issue: GitHub.