{"record":{"id":"c9dcf2cf47cf51e0","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-connection-pool-w-c9dcf2","errorCode":null,"errorMessage":"unable to create connection pool: %w","messagePattern":"unable to create connection pool: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/sources/yugabytedb/yugabytedb.go","lineNumber":160,"sourceCode":"\ti := fmt.Sprintf(\"postgres://%s:%s@%s:%s/%s\", user, pass, host, port, dbname)\n\tif loadBalance == \"true\" {\n\t\ti = fmt.Sprintf(\"%s?load_balance=%s\", i, loadBalance)\n\t\tif topologyKeys != \"\" {\n\t\t\ti = fmt.Sprintf(\"%s&topology_keys=%s\", i, topologyKeys)\n\t\t\tif explicitFallback == \"true\" {\n\t\t\t\ti = fmt.Sprintf(\"%s&fallback_to_topology_keys_only=%s\", i, explicitFallback)\n\t\t\t}\n\t\t}\n\t\tif refreshInterval != \"\" {\n\t\t\ti = fmt.Sprintf(\"%s&yb_servers_refresh_interval=%s\", i, refreshInterval)\n\t\t}\n\t\tif failedHostTTL != \"\" {\n\t\t\ti = fmt.Sprintf(\"%s&failed_host_reconnect_delay_secs=%s\", i, failedHostTTL)\n\t\t}\n\t}\n\tpool, err := pgxpool.New(ctx, i)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create connection pool: %w\", err)\n\t}\n\n\treturn pool, nil\n}\n","sourceCodeStart":142,"sourceCodeEnd":165,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/yugabytedb/yugabytedb.go#L142-L165","documentation":"The YugabyteDB source failed to construct its pgx connection pool. initYugabyteDBConnectionPool assembles a pgx connection string from config (host, port, user, pass, load balance, topology keys, etc.) and calls pgxpool.New; any failure there — bad DSN, DNS resolution failure, unreachable node, auth rejection — is wrapped with this message.","triggerScenarios":"Initialize is called for the yugabytedb source and pgxpool.New returns an error, e.g., malformed connection parameters (invalid topology_keys or refresh_interval in the DSN), unresolvable hostname, or no reachable YugabyteDB node.","commonSituations":"Wrong host/port in the toolbox config, typo in connection string query parameters (load_balance, topology_keys, failed_host_reconnect_delay_secs), database not started or firewall blocking port 5433, wrong credentials, Kubernetes service DNS not resolving.","solutions":["Read the wrapped error; a DSN parse error names the invalid parameter — fix the source config (host, port, user, password, dbname).","Verify connectivity: run ysqlsh or pg_isready against host:port from the toolbox host; open firewall/security-group rules if blocked.","Check optional DSN parameters (load_balance, topology_keys, refresh_interval, explicit_fallbacks, failed_host_reconnect_delay_secs) for typos or unsupported values for your YugabyteDB version.","Confirm the YugabyteDB cluster (YSQL/ycql pods) is running and the service DNS resolves.","Test credentials directly with ysqlsh -h host -p port -U user -d dbname."],"exampleFix":"// before (config)\nhost: \"yb-tserver.internal\", topologyKeys: \"region=us-west1\" // wrong region\n// after\nhost: \"yb-tserver.internal\", topologyKeys: \"region=us-east1.zone-a\"","handlingStrategy":"validation","validationCode":"// Pre-flight check before configuring the source\nimport net from 'node:net';\nconst s = net.createConnection({ host: cfg.host, port: Number(cfg.port) });\ns.on('connect', () => s.end());\ns.on('error', () => console.error('YugabyteDB host unreachable'));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify host/port/user/password/dbname with ysqlsh or pg_isready before configuring the source.","Double-check DSN query parameters (load_balance, topology_keys, refresh_interval, explicit_fallbacks, failed_host_reconnect_delay_secs) for typos.","Ensure the YSQL endpoint is running and firewall/DNS rules allow access from the toolbox host.","Keep optional parameters within values supported by your YugabyteDB version.","Use health checks in deployment to catch unreachable clusters early."],"tags":["database","yugabytedb","connection-pool","pgx","startup"],"backgroundTag":"connection-pool-creation-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}