{"record":{"id":"66c6a193b0d4fc9a","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-pool-w","errorCode":null,"errorMessage":"unable to create pool: %w","messagePattern":"unable to create pool: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/sources/alloydbpg/alloydb_pg.go","lineNumber":74,"sourceCode":"\tRegion       string         `yaml:\"region\" validate:\"required\"`\n\tCluster      string         `yaml:\"cluster\" validate:\"required\"`\n\tInstance     string         `yaml:\"instance\" validate:\"required\"`\n\tIPType       sources.IPType `yaml:\"ipType\" validate:\"required\"`\n\tUser         string         `yaml:\"user\"`\n\tPassword     string         `yaml:\"password\"`\n\tDatabase     string         `yaml:\"database\" validate:\"required\"`\n\tReadOnly     bool           `yaml:\"readOnly\"`\n\tSQLCommenter *bool          `yaml:\"sqlCommenter\"`\n}\n\nfunc (r Config) SourceConfigType() string {\n\treturn SourceType\n}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tpool, err := initAlloyDBPgConnectionPool(ctx, tracer, r.Name, r.Project, r.Region, r.Cluster, r.Instance, r.IPType.String(), r.User, r.Password, r.Database, r.ReadOnly)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create pool: %w\", err)\n\t}\n\n\terr = pool.Ping(ctx)\n\tif err != nil {\n\t\tpool.Close()\n\t\tif r.ReadOnly &&\n\t\t\tstrings.Contains(err.Error(), \"unrecognized configuration parameter\") &&\n\t\t\tstrings.Contains(err.Error(), \"alloydb_session_read_only\") {\n\t\t\treturn nil, fmt.Errorf(\"failed to initialize AlloyDB source in read-only mode: 'alloydb_session_read_only' is not supported on this instance version. See documentation for details: https://mcp-toolbox.dev/integrations/alloydb/source/#reference: %w\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"unable to connect successfully: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig: r,\n\t\tPool:   pool,\n\t}\n\treturn s, nil","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/alloydbpg/alloydb_pg.go#L56-L92","documentation":"The alloydbpg source's Initialize builds a pgx connection pool via the AlloyDB Go Connector (initAlloyDBPgConnectionPool). This error wraps any failure while constructing that pool — dialer setup, credential resolution, or initial connection creation during pool warm-up. The source cannot be registered without a working pool.","triggerScenarios":"Config.Initialize with bad project/region/cluster/instance coordinates, missing Application Default Credentials, invalid ipType, unreachable network, or IAM auth misconfiguration passed to initAlloyDBPgConnectionPool.","commonSituations":"Typo'd cluster/instance names, running outside GCP without GOOGLE_APPLICATION_CREDENTIALS set, VPC/private-IP instances unreachable from the client, or password/user misconfiguration (e.g. password without username — see error 429).","solutions":["Check the wrapped error message for the root cause (DNS, auth, dial timeout).","Verify project, region, cluster, and instance values against `gcloud alloydb instances list`.","Ensure ADC is available: run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS.","If using private IP, run from a network that can reach the instance; switch ipType to public for testing.","Confirm the database user/password are correct and IAM auth settings match the instance config."],"exampleFix":"// before\nsource: my-source\n  kind: alloydb-postgres\n  project: my-proj\n  cluster: my-clstr\n  instance: my-instc  # typo\n// after\nsource: my-source\n  kind: alloydb-postgres\n  project: my-proj\n  cluster: my-cluster\n  instance: my-instance","handlingStrategy":"validation","validationCode":"// Validate config + credentials before starting the server\ngcloud alloydb instances describe INSTANCE --cluster=CLUSTER --region=REGION --project=PROJECT\ngcloud auth application-default print-access-token > /dev/null || echo \"ADC not set\"\n# ensure ipType is one of: public, private, psc","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil && strings.Contains(err.Error(), \"unable to create pool\") {\n    // check project/cluster/instance names, ADC, and network reachability, then re-init\n    return fmt.Errorf(\"alloydb pool init failed, check config and credentials: %w\", err)\n}","preventionTips":["Verify project/region/cluster/instance with gcloud before deploying","Set GOOGLE_APPLICATION_CREDENTIALS or run gcloud auth application-default login","Run from a network that can reach the instance for the chosen ipType","Keep user/password consistent with instance IAM settings"],"tags":["go","database","alloydb","connection-pool","initialization"],"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"}