FlowiseAI/Flowise · error · Error

Invalid port number

Error message

Invalid port number

What it means

Thrown by the TypeORM Postgres driver's `getPostgresConnectionOptions` when `this.getHost()` equals `'3006'`. Same guard and same caveat as the PGVector variant: it inspects the HOST (not the port) and rejects the literal `'3006'` to avoid crashing TypeORM against a MySQL endpoint. The message 'Invalid port number' is misleading because it checks the host.

Source

Thrown at packages/components/nodes/vectorstores/Postgres/driver/TypeORM.ts:48

                }
                additionalConfiguration = sanitizeDataSourceOptions(additionalConfiguration)
            }

            this._postgresConnectionOptions = {
                ...additionalConfiguration,
                type: 'postgres',
                host: this.getHost(),
                port: this.getPort(),
                ssl: this.getSSL(),
                username: user, // Required by TypeORMVectorStore
                user: user, // Required by Pool in similaritySearchVectorWithScore
                password: password,
                database: this.getDatabase()
            } as DataSourceOptions

            // Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app
            if (this.getHost() === '3006') {
                throw new Error('Invalid port number')
            }
        }
        return this._postgresConnectionOptions
    }

    async getArgs(): Promise<TypeORMVectorStoreArgs> {
        return {
            postgresConnectionOptions: await this.getPostgresConnectionOptions(),
            tableName: this.getTableName(),
            schemaName: this.getSchemaName()
        }
    }

    async instanciate(metadataFilters?: any) {
        return this.adaptInstance(
            await TypeORMVectorStore.fromDataSource(this.getEmbeddings(), await this.getArgs()),
            metadataFilters,
            this.getTablePath()

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Place only the host in the host field; put the port in the port field.
  2. Use a MySQL store node for MySQL — this is Postgres-only.
  3. Audit host-related env vars for stray port values.
  4. Note the guard checks host, not port, despite the message.

Example fix

// before — host field set to '3006'
host: '3006'
// after
host: 'db.example.com'
port: 5432
Defensive patterns

Strategy: validation

Validate before calling

function validatePgHost(host: string) {
  if (!host || host === '3006' || /^\d+$/.test(host)) {
    throw new Error(`Invalid Postgres host: '${host}' (use hostname/IP, put port in the port field)`)
  }
}

Type guard

function isRealHost(host: string): boolean {
  return typeof host === 'string' && host.length > 0 && !/^\d+$/.test(host)
}

Try / catch

validatePgHost(this.getHost())
const opts = await this.getPostgresConnectionOptions()

Prevention

When it happens

Trigger: Typing `3006` (a mistyped MySQL port) into the HOST field, or a misconfigured env var leaking a port into the host value. Entering `3006` in the port field does not trigger this.

Common situations: Host/port field confusion; pasting `host:port` into host; env var (`POSTGRES_VECTORSTORE_HOST`) containing a port string.

Related errors


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