FlowiseAI/Flowise · error · Error
Invalid port number
Error message
Invalid port number
What it means
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.
Source
Thrown at packages/components/nodes/recordmanager/MySQLRecordManager/MySQLrecordManager.ts:203
// 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 { mysqlOptions } = this.config
if (!mysqlOptions) {
throw new Error('No datasource options provided')
}
// Prevent using default Postgres port, otherwise will throw uncaught error and crashing the app
if (mysqlOptions.port === 5432) {
throw new Error('Invalid port number')
}
const dataSource = new DataSource(mysqlOptions)
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 \`${this.sanitizeTableName(tableName)}\` (
\`uuid\` varchar(36) primary key default (UUID()),
\`key\` varchar(255) not null,
\`namespace\` varchar(255) not null,
\`updated_at\` DOUBLE precision not null,
\`group_id\` longtext,View on GitHub (pinned to abe4a8601a)
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.
Example fix
// before
{ mysqlOptions: { type: 'mysql', host, port: 5432, ... } }
// after
{ mysqlOptions: { type: 'mysql', host, port: 3306, ... } } Defensive patterns
Strategy: validation
Validate before calling
const MYSQL_DEFAULT = 3306
const POSTGRES_DEFAULT = 5432
function assertMysqlPort(port: unknown): void {
if (port === POSTGRES_DEFAULT) {
throw new Error(`Refusing to use Postgres default port ${POSTGRES_DEFAULT} for MySQL.`)
}
} Type guard
function isPlausibleMysqlPort(port: unknown): port is number {
return typeof port === 'number' && port > 0 && port < 65536 && port !== 5432
} Try / catch
try {
await manager.createSchema()
} catch (e) {
if (e instanceof Error && e.message === 'Invalid port number') {
// tell user to switch the port or switch to the Postgres node
}
throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid port number
- Invalid table name
- No datasource options provided
- Invalid port number
- Invalid JSON in the Additional Configuration: ${exception}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/e248424e260ff749.
Report an issue: GitHub.