{"record":{"id":"e248424e260ff749","repo":"FlowiseAI/Flowise","slug":"invalid-port-number-e24842","errorCode":null,"errorMessage":"Invalid port number","messagePattern":"Invalid port number","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/recordmanager/MySQLRecordManager/MySQLrecordManager.ts","lineNumber":203,"sourceCode":"        // 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 { mysqlOptions } = this.config\n        if (!mysqlOptions) {\n            throw new Error('No datasource options provided')\n        }\n        // Prevent using default Postgres port, otherwise will throw uncaught error and crashing the app\n        if (mysqlOptions.port === 5432) {\n            throw new Error('Invalid port number')\n        }\n        const dataSource = new DataSource(mysqlOptions)\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(`create table if not exists \\`${this.sanitizeTableName(tableName)}\\` (\n                \\`uuid\\` varchar(36) primary key default (UUID()),\n                \\`key\\` varchar(255) not null,\n                \\`namespace\\` varchar(255) not null,\n                \\`updated_at\\` DOUBLE precision not null,\n                \\`group_id\\` longtext,","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/recordmanager/MySQLRecordManager/MySQLrecordManager.ts#L185-L221","documentation":"Thrown by MySQLRecordManager.getDataSource when mysqlOptions.port === 5432. 5432 is the default PostgreSQL port; connecting TypeORM's mysql driver to a Postgres server produces an opaque, uncaught protocol error that crashes the app. This guard converts that into a readable message instead.","triggerScenarios":"User selects a MySQL Record Manager but fills the port field with 5432 (the Postgres default they copied from another node), or a credential template defaults the port to 5432.","commonSituations":"Mixing up MySQL and Postgres credentials; reusing a Postgres connection string and only changing the type flag; copy-pasting port from a Pinecone/PGVector example.","solutions":["Set the MySQL port to 3306 (or your cluster's actual MySQL port) in the credential / additionalConfig.","If you genuinely meant Postgres, switch to the Postgres Record Manager node instead.","Audit the credential to ensure host/port/type are mutually consistent."],"exampleFix":"// before\n{ mysqlOptions: { type: 'mysql', host, port: 5432, ... } }\n// after\n{ mysqlOptions: { type: 'mysql', host, port: 3306, ... } }","handlingStrategy":"validation","validationCode":"const MYSQL_DEFAULT = 3306\nconst POSTGRES_DEFAULT = 5432\nfunction assertMysqlPort(port: unknown): void {\n  if (port === POSTGRES_DEFAULT) {\n    throw new Error(`Refusing to use Postgres default port ${POSTGRES_DEFAULT} for MySQL.`)\n  }\n}","typeGuard":"function isPlausibleMysqlPort(port: unknown): port is number {\n  return typeof port === 'number' && port > 0 && port < 65536 && port !== 5432\n}","tryCatchPattern":"try {\n  await manager.createSchema()\n} catch (e) {\n  if (e instanceof Error && e.message === 'Invalid port number') {\n    // tell user to switch the port or switch to the Postgres node\n  }\n  throw e\n}","preventionTips":["Keep MySQL and Postgres credentials in clearly named, separate credential entries.","Default the MySQL port field to 3306 in the node's input params.","Cross-check the credential's 'type' field against the selected Record Manager."],"tags":["mysql","record-manager","config","port","wrong-driver"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}