FlowiseAI/Flowise · error · Error

Invalid port number

Error message

Invalid port number

What it means

Thrown by the PGVector driver's `getPostgresConnectionOptions` when `this.getHost()` equals the string `'3006'`. Despite the message 'Invalid port number', the guard actually inspects the HOST value and rejects the literal string '3006' — a defensive check to prevent accidentally pointing a Postgres store at the MySQL port (the comment says it avoids an uncaught crash). Note MySQL's real default is 3306, so the literal is itself questionable.

Solutions

  1. Put only the hostname/IP in the host field and the port in the separate port field.
  2. If you genuinely need MySQL, use a MySQL node — this is a Postgres-only store.
  3. Check environment variables (e.g. POSTGRES_VECTORSTORE_HOST) for stray port values.
  4. Be aware the guard checks host, not port; the message is misleading.

Example fix

// before — host field contains '3006'
host: '3006'
// after — host and port in their own fields
host: 'db.example.com'
port: 5432
Defensive patterns

Strategy: validation

Validate before calling

// host must not be a port-like MySQL value
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: User mistakenly types the MySQL port `3006` (intended `3306`) into the HOST field, or a template/credential populates the host with a port-like value. Because the check is on host, putting `3006` in the port field does NOT trigger this.

Common situations: Confusing host and port fields; pasting a `host:port` string into the host field; env var misconfiguration that leaks a port into the host value.

Related errors


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

Appendix: source

Thrown at packages/components/nodes/vectorstores/Postgres/driver/PGVector.ts:45

                    additionalConfiguration = typeof additionalConfig === 'object' ? additionalConfig : JSON.parse(additionalConfig)
                } catch (exception) {
                    throw new Error('Invalid JSON in the Additional Configuration: ' + exception)
                }
                additionalConfiguration = sanitizeDataSourceOptions(additionalConfiguration)
            }

            this._postgresConnectionOptions = {
                ...additionalConfiguration,
                host: this.getHost(),
                port: this.getPort(),
                user: user,
                password: password,
                database: this.getDatabase()
            }

            // 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<PGVectorStoreArgs> {
        return {
            postgresConnectionOptions: await this.getPostgresConnectionOptions(),
            tableName: this.getTableName(),
            columns: {
                contentColumnName: getContentColumnName(this.nodeData)
            },
            distanceStrategy: (this.nodeData.inputs?.distanceStrategy || 'cosine') as DistanceStrategy
        }
    }

    async instanciate(metadataFilters?: any) {

View on GitHub (pinned to abe4a8601a)