FlowiseAI/Flowise · critical · Error

No datasource options provided

Error message

No datasource options provided

What it means

Thrown by PostgresRecordManager.getDataSource when config.postgresConnectionOptions is falsy. This is the Postgres analog of error 261: without connection options the manager cannot build a TypeORM DataSource and aborts before any network call.

Source

Thrown at packages/components/nodes/recordmanager/PostgresRecordManager/PostgresRecordManager.ts:211

    config: PostgresRecordManagerOptions
    tableName: string
    namespace: string

    constructor(namespace: string, config: PostgresRecordManagerOptions) {
        const { tableName } = config
        this.namespace = namespace
        this.tableName = tableName
        this.config = config
    }

    sanitizeTableName(tableName: string): string {
        return sanitizeRecordManagerTableName(tableName)
    }

    private async getDataSource(): Promise<DataSource> {
        const { postgresConnectionOptions } = this.config
        if (!postgresConnectionOptions) {
            throw new Error('No datasource options provided')
        }
        // Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app
        if (postgresConnectionOptions.port === 3006) {
            throw new Error('Invalid port number')
        }
        const dataSource = new DataSource(postgresConnectionOptions)
        await dataSource.initialize()
        return dataSource
    }

    async createSchema(): Promise<void> {
        const dataSource = await this.getDataSource()
        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

  1. Select a Postgres credential in the node, or supply postgresConnectionOptions in additionalConfig.
  2. Verify the init flow: getHost/getPort/getSSL/user/password must all resolve; if any are blank the merged object may still be truthy but useless - check those separately.
  3. Programmatically: new PostgresRecordManager(config, { postgresConnectionOptions: {...} }).

Example fix

// before
const mgr = new PostgresRecordManager({ tableName: 'records' }, {})
// after
const mgr = new PostgresRecordManager(
  { tableName: 'records' },
  { postgresConnectionOptions: { type: 'postgres', host, port: 5432, username, password, database } }
)
Defensive patterns

Strategy: validation

Validate before calling

function hasPostgresOptions(cfg: unknown): cfg is { postgresConnectionOptions: Record<string, unknown> } {
  return !!cfg && typeof cfg === 'object' && !!((cfg as any).postgresConnectionOptions)
}
if (!hasPostgresOptions(config)) {
  throw new Error('postgresConnectionOptions missing in config.')
}

Type guard

function isPostgresConfig(cfg: unknown): cfg is { postgresConnectionOptions: { host: string; port: number; username: string; password: string; database: string } } {
  const o = (cfg as any)?.postgresConnectionOptions
  return !!o && typeof o.host === 'string' && typeof o.port === 'number'
}

Try / catch

try {
  await manager.createSchema()
} catch (e) {
  if (e instanceof Error && e.message === 'No datasource options provided') {
    // prompt for Postgres credential
  }
  throw e
}

Prevention

When it happens

Trigger: Instantiating PostgresRecordManager with a config that omits postgresConnectionOptions; the init path failed to merge host/port/user/password into the options object; the credential binding is empty.

Common situations: Record Manager node has no Postgres credential selected; additionalConfig JSON parsed but did not include connection fields; programmatic use forgot the second constructor argument.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/fe78e2d446ea46a2. Report an issue: GitHub.