{"record":{"id":"174b26a07a0348c7","repo":"FlowiseAI/Flowise","slug":"no-datasource-options-provided-174b26","errorCode":null,"errorMessage":"No datasource options provided","messagePattern":"No datasource options provided","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/memory/AgentMemory/PostgresAgentMemory/pgSaver.ts","lineNumber":37,"sourceCode":"        this.threadId = threadId\n    }\n\n    sanitizeTableName(tableName: string): string {\n        // Trim and normalize case, turn whitespace into underscores\n        tableName = tableName.trim().toLowerCase().replace(/\\s+/g, '_')\n\n        // Validate using a regex (alphanumeric and underscores only)\n        if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {\n            throw new Error('Invalid table name')\n        }\n\n        return tableName\n    }\n\n    private async getDataSource(): Promise<DataSource> {\n        const { datasourceOptions } = this.config\n        if (!datasourceOptions) {\n            throw new Error('No datasource options provided')\n        }\n        // Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app\n        if (datasourceOptions.port === 3006) {\n            throw new Error('Invalid port number')\n        }\n        const dataSource = new DataSource(datasourceOptions)\n        await dataSource.initialize()\n        return dataSource\n    }\n\n    private async setup(dataSource: DataSource): Promise<void> {\n        if (this.isSetup) {\n            return\n        }\n\n        try {\n            const queryRunner = dataSource.createQueryRunner()\n            const tableName = this.sanitizeTableName(this.tableName)","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/memory/AgentMemory/PostgresAgentMemory/pgSaver.ts#L19-L55","documentation":"PostgresSaver.getDataSource destructures datasourceOptions from this.config and throws if falsy, before constructing a DataSource. Indicates the saver was built without connection options.","triggerScenarios":"PostgresAgentMemory.init produced a SaverOptions that did not include datasourceOptions (credential missing, connection fields empty, options not threaded).","commonSituations":"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.","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."],"exampleFix":"// before\nnew PostgresSaver({ threadId })\n// after\nnew PostgresSaver({ threadId, datasourceOptions: { type:'postgres', host, port:5432, username, password, database } })","handlingStrategy":"validation","validationCode":"function buildSaverConfig(threadId: string, opts?: Record<string, unknown>) {\n  if (!opts || Object.keys(opts).length === 0) throw new Error('datasourceOptions missing')\n  return { threadId, datasourceOptions: opts }\n}\nconst saver = new PostgresSaver(buildSaverConfig(threadId, datasourceOptions))","typeGuard":"function hasDatasourceOptions(config: unknown): config is { datasourceOptions: Record<string, unknown> } {\n  return typeof config === 'object' && config !== null && Boolean((config as any).datasourceOptions)\n}","tryCatchPattern":"try {\n  await saver.getTuple(config)\n} catch (e) {\n  if (/No datasource options/.test((e as Error).message)) {\n    // surface a credential/configuration error; do not retry\n  }\n  throw e\n}","preventionTips":["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."],"tags":["postgres","agent-memory","configuration","datasource","memory"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}