{"record":{"id":"4d7825d0c474ccbd","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-pool-w-4d7825","errorCode":null,"errorMessage":"unable to create pool: %w","messagePattern":"unable to create pool: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/clickhouse/clickhouse.go","lineNumber":69,"sourceCode":"\tName     string `yaml:\"name\" validate:\"required\"`\n\tType     string `yaml:\"type\" validate:\"required\"`\n\tHost     string `yaml:\"host\" validate:\"required\"`\n\tPort     string `yaml:\"port\" validate:\"required\"`\n\tDatabase string `yaml:\"database\" validate:\"required\"`\n\tUser     string `yaml:\"user\" validate:\"required\"`\n\tPassword string `yaml:\"password\"`\n\tProtocol string `yaml:\"protocol\"`\n\tSecure   bool   `yaml:\"secure\"`\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 := initClickHouseConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database, r.Protocol, r.Secure)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create pool: %w\", err)\n\t}\n\n\terr = pool.PingContext(ctx)\n\tif err != nil {\n\t\tpool.Close()\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\n}\n\nvar _ sources.Source = &Source{}\n\ntype Source struct {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/clickhouse/clickhouse.go#L51-L87","documentation":"clickhouse.Config.Initialize wraps any failure from initClickHouseConnectionPool (building the sqlx/database-sql connection pool) with this message. It means the pool object itself could not be created, typically due to invalid DSN or driver issues.","triggerScenarios":"Calling Initialize on a clickhouse Config when the driver cannot construct a pool from host/port/user/password/database/protocol/secure parameters.","commonSituations":"Invalid host or port format, unsupported protocol (http/native), bad DSN characters in credentials, missing driver registration.","solutions":["Verify host, port, protocol values are valid and correctly formatted.","Check special characters in user/password are URL-escaped in the DSN.","Confirm the ClickHouse server accepts connections on the configured port (8123 http / 9000 native).","Read the wrapped error (%w) for the driver's root cause."],"exampleFix":"// before\nr := clickhouse.Config{Host: \"ch host\", Port: \"notaport\"}\n// after\nr := clickhouse.Config{Host: \"127.0.0.1\", Port: \"8123\", Protocol: \"http\"}","handlingStrategy":"validation","validationCode":"if r.Host == \"\" || r.Port == \"\" { return errors.New(\"clickhouse host/port required\") }\nif _, err := strconv.Atoi(r.Port); err != nil { return fmt.Errorf(\"invalid port: %w\", err) }","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n    if strings.Contains(err.Error(), \"unable to create pool\") { return err } // config-level, no retry\n    return err\n}","preventionTips":["Validate host/port/protocol values before Initialize.","URL-escape credentials in generated DSNs.","Test pool creation in CI against a local ClickHouse."],"tags":["clickhouse","initialization","connection-pool"],"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"}