googleapis/mcp-toolbox · error
unable to create pool: %w
Error message
unable to create pool: %w
What it means
Wrapped by Firebird Config.Initialize when initFirebirdConnectionPool fails to even open a database/sql pool via the firebirdsql driver. sql.Open only validates the DSN format and driver registration, so this almost always indicates a malformed connection string rather than a network problem.
Source
Thrown at internal/sources/firebird/firebird.go:65
type Config struct {
Name string `yaml:"name" validate:"required"`
Type string `yaml:"type" validate:"required"`
Host string `yaml:"host" validate:"required"`
Port string `yaml:"port" validate:"required"`
User string `yaml:"user" validate:"required"`
Password string `yaml:"password" validate:"required"`
Database string `yaml:"database" validate:"required"`
}
func (r Config) SourceConfigType() string {
return SourceType
}
func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
pool, err := initFirebirdConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database)
if err != nil {
return nil, fmt.Errorf("unable to create pool: %w", err)
}
err = pool.PingContext(ctx)
if err != nil {
pool.Close()
return nil, fmt.Errorf("unable to connect successfully: %w", err)
}
s := &Source{
Config: r,
Db: pool,
}
return s, nil
}
var _ sources.Source = &Source{}
type Source struct {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Check each DSN component is non-empty and properly escaped (URL-encode or escape ':' '@' '/' in user and password)
- Confirm the database file path is absolute and ends in .fdb for local files, or host:port points at a running Firebird server
- Ensure _ "github.com/mattn/go-adodb"-style blank import of firebirdsql driver is present (github.com/flygo/fb or mattn/go-firebirdsql per go.mod)
- Test the DSN manually with a Firebird client (isql) using the same credentials
Example fix
// before
pool, err := initFirebirdConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database)
if err != nil {
return nil, fmt.Errorf("unable to create pool: %w", err)
}
// after
if r.Host == "" || r.Database == "" {
return nil, fmt.Errorf("invalid firebird config: host and database are required")
}
pool, err := initFirebirdConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database)
if err != nil {
return nil, fmt.Errorf("unable to create pool: %w", err)
} Defensive patterns
Strategy: validation
Validate before calling
// Validate DSN components before Initialize
func validateFirebirdConfig(host, port, user, pass, db string) error {
if host == "" || port == "" || user == "" || db == "" {
return errors.New("firebird config: host, port, user and database are required")
}
if strings.ContainsAny(user+pass, ":@/") {
return errors.New("firebird config: user/password contain unescaped DSN characters (: @ /)")
}
return nil
} Type guard
func isDriverMissing(err error) bool {
return strings.Contains(err.Error(), "unknown driver")
} Try / catch
pool, err := initFirebirdConnectionPool(ctx, tracer, name, host, port, user, pass, db)
if err != nil {
if isDriverMissing(err) {
return nil, fmt.Errorf("firebirdsql driver not registered; add blank import: %w", err)
}
return nil, fmt.Errorf("unable to create pool: %w", err)
} Prevention
- Blank-import the firebirdsql driver next to database/sql usage
- Escape or forbid ':', '@', '/' in credentials used in DSNs
- Fail fast with field-level config validation before building DSNs
- Verify registered drivers with sql.Drivers() in a startup check
When it happens
Trigger: Initialize called with a Config whose Name/Host/Port/User/Password/Database produce an invalid DSN (e.g. empty fields, special chars like '@' or ':' in the password breaking user:password@host:port/db format), or the firebirdsql driver not registered.
Common situations: Password containing ':' or '@' unescaped; empty database path (must end in .fdb and include full path for embedded); blank host/port fields from missing config; blank import of the firebirdsql driver missing so sql.Open returns unknown driver.
Related errors
- unable to parse connection uri: %w
- unable to create connection pool: %w
- sql.Open: %w
- sql.Open: %w
- sql.Open: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/b8017af14404b01a.
Report an issue: GitHub.