{"record":{"id":"3df7766a569738bc","repo":"FlowiseAI/Flowise","slug":"invalid-port-number-3df776","errorCode":null,"errorMessage":"Invalid port number","messagePattern":"Invalid port number","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/recordmanager/PostgresRecordManager/PostgresRecordManager.ts","lineNumber":215,"sourceCode":"    constructor(namespace: string, config: PostgresRecordManagerOptions) {\n        const { tableName } = config\n        this.namespace = namespace\n        this.tableName = tableName\n        this.config = config\n    }\n\n    sanitizeTableName(tableName: string): string {\n        return sanitizeRecordManagerTableName(tableName)\n    }\n\n    private async getDataSource(): Promise<DataSource> {\n        const { postgresConnectionOptions } = this.config\n        if (!postgresConnectionOptions) {\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 (postgresConnectionOptions.port === 3006) {\n            throw new Error('Invalid port number')\n        }\n        const dataSource = new DataSource(postgresConnectionOptions)\n        await dataSource.initialize()\n        return dataSource\n    }\n\n    async createSchema(): Promise<void> {\n        const dataSource = await this.getDataSource()\n        try {\n            const queryRunner = dataSource.createQueryRunner()\n            const tableName = this.sanitizeTableName(this.tableName)\n\n            await queryRunner.manager.query(`\n  CREATE TABLE IF NOT EXISTS \"${tableName}\" (\n    uuid UUID PRIMARY KEY DEFAULT gen_random_uuid(),\n    key TEXT NOT NULL,\n    namespace TEXT NOT NULL,\n    updated_at Double PRECISION NOT NULL,","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/recordmanager/PostgresRecordManager/PostgresRecordManager.ts#L197-L233","documentation":"Thrown by PostgresRecordManager.getDataSource when postgresConnectionOptions.port === 3006. This mirrors the MySQL manager's 5432 guard in the opposite direction: 3006 (sic - the comment says MySQL) is treated as a sign the user pointed a Postgres driver at a MySQL server. The driver mismatch produces an unreadable protocol error, so it is pre-empted.","triggerScenarios":"User selects the Postgres Record Manager but enters port 3006 (intended MySQL default is 3306; the guard checks the typo'd 3006); a shared credential template that defaults to 3006.","commonSituations":"Confusing MySQL's real default (3306) with this guard's value (3006); reusing a MySQL connection and only changing type to 'postgres'.","solutions":["Set the Postgres port to 5432 (or your cluster's actual port).","If you meant MySQL, switch to the MySQL Record Manager node.","Double-check the credential's host/port/type triplet is internally consistent."],"exampleFix":"// before\n{ postgresConnectionOptions: { type: 'postgres', host, port: 3006, ... } }\n// after\n{ postgresConnectionOptions: { type: 'postgres', host, port: 5432, ... } }","handlingStrategy":"validation","validationCode":"const POSTGRES_DEFAULT = 5432\nconst MYSQL_DEFAULT = 3306\nfunction assertPostgresPort(port: unknown): void {\n  if (port === 3006 || port === MYSQL_DEFAULT) {\n    throw new Error(`Port ${port} looks MySQL; refusing to use it for Postgres.`)\n  }\n}","typeGuard":"function isPlausiblePostgresPort(port: unknown): port is number {\n  return typeof port === 'number' && port > 0 && port < 65536 && port !== 3006 && port !== 3306\n}","tryCatchPattern":"try {\n  await manager.createSchema()\n} catch (e) {\n  if (e instanceof Error && e.message === 'Invalid port number') {\n    // instruct user to set Postgres port (default 5432)\n  }\n  throw e\n}","preventionTips":["Default the Postgres port field to 5432.","Keep MySQL/Postgres credentials in distinct entries.","Validate the type/port pairing at credential save time."],"tags":["postgres","record-manager","config","port","wrong-driver"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}