{"record":{"id":"1c2c68e3734ad9e1","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-connection-pool-w","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/firebird/firebird.go","lineNumber":160,"sourceCode":"\t\treturn nil, fmt.Errorf(\"error iterating rows: %w\", err)\n\t}\n\n\t// In most cases, DML/DDL statements like INSERT, UPDATE, CREATE, etc. might return no rows\n\t// However, it is also possible that this was a query that was expected to return rows\n\t// but returned none, a case that we cannot distinguish here.\n\treturn out, nil\n}\n\nfunc initFirebirdConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname string) (*sql.DB, error) {\n\t_, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)\n\tdefer span.End()\n\n\t// urlExample := \"user:password@host:port/path/to/database.fdb\"\n\tdsn := fmt.Sprintf(\"%s:%s@%s:%s/%s\", user, pass, host, port, dbname)\n\n\tdb, err := sql.Open(\"firebirdsql\", dsn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create connection pool: %w\", err)\n\t}\n\n\t// Configure connection pool to prevent deadlocks\n\tdb.SetMaxOpenConns(5)\n\tdb.SetMaxIdleConns(2)\n\tdb.SetConnMaxLifetime(5 * time.Minute)\n\tdb.SetConnMaxIdleTime(1 * time.Minute)\n\n\treturn db, nil\n}\n","sourceCodeStart":142,"sourceCodeEnd":171,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/firebird/firebird.go#L142-L171","documentation":"Wrapped by initFirebirdConnectionPool when sql.Open(\"firebirdsql\", dsn) fails. sql.Open validates driver registration and DSN format only; the dominant real-world cause is the firebirdsql driver never being registered via a blank import, followed by a malformed DSN string.","triggerScenarios":"initFirebirdConnectionPool called with user:pass@host:port/dbname containing unescaped ':' '@' '/' characters, empty segments, or the \"firebirdsql\" driver name absent from sql.Drivers() because the package import was removed.","commonSituations":"Passwords with special characters; missing `import _ \"github.com/mattn/go-firebirdsql\"`-style registration; mistyped driver name; DSN assembled from empty config fields.","solutions":["Add/verify the blank import that registers the firebirdsql driver","Escape special characters in user/password or switch to a DSN builder","Log sql.Drivers() to confirm \"firebirdsql\" is registered before Open","Validate config fields are non-empty before building the DSN"],"exampleFix":"// before\nimport (\n    \"database/sql\"\n)\ndb, err := sql.Open(\"firebirdsql\", dsn)\n// after\nimport (\n    \"database/sql\"\n    _ \"github.com/mattn/go-firebirdsql\"\n)\ndb, err := sql.Open(\"firebirdsql\", dsn)","handlingStrategy":"validation","validationCode":"// Preflight: driver registered + DSN shape valid\nfunc preflightFirebird(user, pass, host, port, dbname string) error {\n    found := false\n    for _, d := range sql.Drivers() {\n        if d == \"firebirdsql\" { found = true }\n    }\n    if !found { return errors.New(`driver \"firebirdsql\" not registered; check blank import`) }\n    if strings.ContainsAny(user+pass, \":@/\") { return errors.New(\"unescaped special chars in credentials\") }\n    return nil\n}","typeGuard":"func isOpenErrDriverMissing(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"unknown driver\")\n}","tryCatchPattern":"db, err := sql.Open(\"firebirdsql\", dsn)\nif err != nil {\n    if isOpenErrDriverMissing(err) {\n        return nil, fmt.Errorf(\"firebirdsql driver missing: %w\", err)\n    }\n    return nil, fmt.Errorf(\"unable to create connection pool: %w\", err)\n}","preventionTips":["Keep the blank driver import in the package that calls sql.Open","Centralize DSN construction with escaping in one helper","Add a startup assertion that sql.Drivers() contains \"firebirdsql\"","Reject empty config fields before DSN assembly"],"tags":["firebird","sql-open","driver-registration","dsn"],"backgroundTag":"sql-unknown-driver","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"}