golang-migrate/migrate · error
no config
Error message
no config
What it means
ErrNilConfig (message "no config") is returned by the rqlite driver's WithInstance and WithConnection when the *Config argument is nil. The driver needs a Config to know settings like MigrationsTable and ConnectInsecure, and it dereferences the pointer immediately, so passing nil is rejected up front. It is a programmer error, not a runtime/network problem.
Source
Thrown at database/rqlite/rqlite.go:30
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database"
"github.com/rqlite/gorqlite"
)
func init() {
database.Register("rqlite", &Rqlite{})
}
const (
// DefaultMigrationsTable defines the default rqlite migrations table
DefaultMigrationsTable = "schema_migrations"
// DefaultConnectInsecure defines the default setting for connect insecure
DefaultConnectInsecure = false
)
// ErrNilConfig is returned if no configuration was passed to WithInstance
var ErrNilConfig = fmt.Errorf("no config")
// ErrBadConfig is returned if configuration was invalid
var ErrBadConfig = fmt.Errorf("bad parameter")
// Config defines the driver configuration
type Config struct {
// ConnectInsecure sets whether the connection uses TLS. Ineffectual when using WithInstance
ConnectInsecure bool
// MigrationsTable configures the migrations table name
MigrationsTable string
}
type Rqlite struct {
db *gorqlite.Connection
isLocked atomic.Bool
config *Config
}View on GitHub (pinned to 01a9643f14)
Solutions
- Construct and pass a non-nil config: &rqlite.Config{} (empty struct is accepted; MigrationsTable defaults to schema_migrations)
- Check your factory helper so it never returns a nil *rqlite.Config
- Note this check is per-driver: database/rqlite.ErrNilConfig is a distinct value from cassandra/pgx ErrNilConfig — compare with errors.Is against the right package
Example fix
// before
var cfg *rqlite.Config
driver, err := rqlite.WithInstance(conn, cfg) // nil -> ErrNilConfig
// after
cfg := &rqlite.Config{MigrationsTable: "schema_migrations"}
driver, err := rqlite.WithInstance(conn, cfg) Defensive patterns
Strategy: validation
Validate before calling
if cfg == nil {
return nil, fmt.Errorf("rqlite: config must be provided")
}
driver, err := rqlite.WithInstance(conn, cfg) Type guard
func hasRqliteConfig(cfg *rqlite.Config) bool { return cfg != nil } Prevention
- Never declare config as a bare *rqlite.Config var; initialize inline with &rqlite.Config{...}
- Default to an empty struct — WithInstance fills MigrationsTable with the default
- Keep config construction in one factory function that cannot return nil without an error
When it happens
Trigger: Calling rqlite.WithInstance(conn, nil) or WithConnection(conn, nil) instead of passing a &rqlite.Config{}.
Common situations: Building the config conditionally and leaving it nil when all env vars are absent; copying driver boilerplate from another package and forgetting to init Config; passing a typed nil (*rqlite.Config)(nil) into a generic helper.
Related errors
AI-assisted analysis of golang-migrate/migrate@01a9643f14 (2026-09-02).
Data as JSON: /api/errors/22fd87e554b970fa.
Report an issue: GitHub.