golang-migrate/migrate · warning
conn: %v, db: %v
Error message
conn: %v, db: %v
What it means
In Firebird.Close, both the raw connection and sql.DB are closed; if either returns an error, the driver wraps both with fmt.Errorf("conn: %v, db: %v", ...). It reports that cleanup of the Firebird connection pool failed, possibly on both handles simultaneously. Note the wrapping discards error identity, so you must string-match to classify it.
Source
Thrown at database/firebird/firebird.go:104
}
px, err := WithInstance(db, &Config{
MigrationsTable: purl.Query().Get("x-migrations-table"),
DatabaseName: purl.Path,
})
if err != nil {
return nil, err
}
return px, nil
}
func (f *Firebird) Close() error {
connErr := f.conn.Close()
dbErr := f.db.Close()
if connErr != nil || dbErr != nil {
return fmt.Errorf("conn: %v, db: %v", connErr, dbErr)
}
return nil
}
func (f *Firebird) Lock() error {
if !f.isLocked.CompareAndSwap(false, true) {
return database.ErrLocked
}
return nil
}
func (f *Firebird) Unlock() error {
if !f.isLocked.CompareAndSwap(true, false) {
return database.ErrNotLocked
}
return nil
}
View on GitHub (pinned to 01a9643f14)
Solutions
- Close the migrate instance once and let it own the connection lifecycle
- Check network/DB availability and retry Close
- Treat Close errors as non-fatal cleanup warnings if migration already succeeded
- If you own the *sql.DB, close it only after migrate.Close() returns
Defensive patterns
Strategy: try-catch
Validate before calling
if sqlDB == nil || conn == nil {
return fmt.Errorf("firebird handles already closed; skip migrate.Close")
} Try / catch
if err := m.Close(); err != nil {
// wrapped as "conn: %v, db: %v" — log and continue on shutdown
log.Printf("firebird close (non-fatal): %v", err)
} Prevention
- Let migrate own the connection; do not close the *sql.DB separately
- Call Close exactly once per migrate instance (use sync.Once in wrappers)
- Treat Close errors during shutdown as warnings unless migrations are in flight
When it happens
Trigger: Calling migrate.Close() (which calls Firebird.Close) when the underlying sql.DB was already closed, the TCP connection to Firebird dropped, or the conn handle was closed elsewhere concurrently.
Common situations: Double-closing a migrate instance, network interruption before shutdown, closing the *sql.DB yourself before migrate.Close(), app shutdown with a stale Firebird connection.
Related errors
AI-assisted analysis of golang-migrate/migrate@01a9643f14 (2026-09-02).
Data as JSON: /api/errors/e7de2ba3d0162fcd.
Report an issue: GitHub.