{"record":{"id":"1891f0ef742d1eb2","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-connection-pool-w-1891f0","errorCode":null,"errorMessage":"unable to create connection pool: %w","messagePattern":"unable to create connection pool: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/postgres/postgres.go","lineNumber":178,"sourceCode":"\n\tconfig, err := pgxpool.ParseConfig(BuildPostgresURL(host, port, user, pass, dbname, queryParams))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse connection uri: %w\", err)\n\t}\n\n\texecMode, err := ParseQueryExecMode(queryExecMode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconfig.ConnConfig.DefaultQueryExecMode = execMode\n\n\tif connectTimeout != nil {\n\t\tconfig.ConnConfig.ConnectTimeout = time.Duration(*connectTimeout) * time.Second\n\t}\n\n\tpool, err := pgxpool.NewWithConfig(ctx, config)\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\n// BuildPostgresURL assembles a postgres connection URL from its components.\n// It uses net.JoinHostPort so IPv6 host literals are wrapped in brackets as\n// required by RFC 3986 (e.g. \"[::1]:5432\"); IPv4 addresses and hostnames are\n// left unchanged. Query parameters are encoded with url.Values so special\n// characters are escaped correctly and the output is deterministic.\nfunc BuildPostgresURL(host, port, user, pass, dbname string, queryParams map[string]string) string {\n\tu := &url.URL{\n\t\tScheme: \"postgres\",\n\t\tUser:   url.UserPassword(user, pass),\n\t\tHost:   net.JoinHostPort(host, port),\n\t\tPath:   dbname,\n\t}\n\tif len(queryParams) > 0 {","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/postgres/postgres.go#L160-L196","documentation":"pgxpool.NewWithConfig failed while establishing the Postgres connection pool during source Initialize; the config parsed fine but the server was unreachable, credentials were rejected, or TLS settings mismatched.","triggerScenarios":"Thrown at internal/sources/postgres/postgres.go:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the Postgres server is running and reachable from the Toolbox host (network, firewall, VPC)","Check username/password and pg_hba.conf rules","Verify TLS/SSL requirements match between client config and server"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}