{"record":{"id":"da3fd713efe07534","repo":"FlowiseAI/Flowise","slug":"invalid-port-number-da3fd7","errorCode":null,"errorMessage":"Invalid port number","messagePattern":"Invalid port number","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Postgres/driver/PGVector.ts","lineNumber":45,"sourceCode":"                    additionalConfiguration = typeof additionalConfig === 'object' ? additionalConfig : JSON.parse(additionalConfig)\n                } catch (exception) {\n                    throw new Error('Invalid JSON in the Additional Configuration: ' + exception)\n                }\n                additionalConfiguration = sanitizeDataSourceOptions(additionalConfiguration)\n            }\n\n            this._postgresConnectionOptions = {\n                ...additionalConfiguration,\n                host: this.getHost(),\n                port: this.getPort(),\n                user: user,\n                password: password,\n                database: this.getDatabase()\n            }\n\n            // Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app\n            if (this.getHost() === '3006') {\n                throw new Error('Invalid port number')\n            }\n        }\n\n        return this._postgresConnectionOptions\n    }\n\n    async getArgs(): Promise<PGVectorStoreArgs> {\n        return {\n            postgresConnectionOptions: await this.getPostgresConnectionOptions(),\n            tableName: this.getTableName(),\n            columns: {\n                contentColumnName: getContentColumnName(this.nodeData)\n            },\n            distanceStrategy: (this.nodeData.inputs?.distanceStrategy || 'cosine') as DistanceStrategy\n        }\n    }\n\n    async instanciate(metadataFilters?: any) {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Postgres/driver/PGVector.ts#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Put only the hostname/IP in the host field and the port in the separate port field.","If you genuinely need MySQL, use a MySQL node — this is a Postgres-only store.","Check environment variables (e.g. POSTGRES_VECTORSTORE_HOST) for stray port values.","Be aware the guard checks host, not port; the message is misleading."],"exampleFix":"// before — host field contains '3006'\nhost: '3006'\n// after — host and port in their own fields\nhost: 'db.example.com'\nport: 5432","handlingStrategy":"validation","validationCode":"// host must not be a port-like MySQL value\nfunction validatePgHost(host: string) {\n  if (!host || host === '3006' || /^\\d+$/.test(host)) {\n    throw new Error(`Invalid Postgres host: '${host}' (use hostname/IP, put port in the port field)`)\n  }\n}","typeGuard":"function isRealHost(host: string): boolean {\n  return typeof host === 'string' && host.length > 0 && !/^\\d+$/.test(host)\n}","tryCatchPattern":"validatePgHost(this.getHost())\nconst opts = await this.getPostgresConnectionOptions()","preventionTips":["Keep host and port in separate fields.","Audit env vars (POSTGRES_VECTORSTORE_HOST) for stray port values.","Use a MySQL node for MySQL, not the Postgres store.","Remember the guard inspects host, not port, despite the message."],"tags":["postgres","pgvector","config","validation","misnomer"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}