{"record":{"id":"d7f2137c959c2146","repo":"golang-migrate/migrate","slug":"no-config-d7f213","errorCode":null,"errorMessage":"no config","messagePattern":"no config","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/sqlite3/sqlite3.go","lineNumber":25,"sourceCode":"\t\"io\"\n\tnurl \"net/url\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync/atomic\"\n\n\t\"github.com/golang-migrate/migrate/v4\"\n\t\"github.com/golang-migrate/migrate/v4/database\"\n\t_ \"github.com/mattn/go-sqlite3\"\n)\n\nfunc init() {\n\tdatabase.Register(\"sqlite3\", &Sqlite{})\n}\n\nvar DefaultMigrationsTable = \"schema_migrations\"\nvar (\n\tErrDatabaseDirty  = fmt.Errorf(\"database is dirty\")\n\tErrNilConfig      = fmt.Errorf(\"no config\")\n\tErrNoDatabaseName = fmt.Errorf(\"no database name\")\n)\n\ntype Config struct {\n\tMigrationsTable string\n\tDatabaseName    string\n\tNoTxWrap        bool\n}\n\ntype Sqlite struct {\n\tdb       *sql.DB\n\tisLocked atomic.Bool\n\n\tconfig *Config\n}\n\nfunc WithInstance(instance *sql.DB, config *Config) (database.Driver, error) {\n\tif config == nil {","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/sqlite3/sqlite3.go#L7-L43","documentation":"ErrNilConfig is a sentinel error in the sqlite3 migrate driver meaning the *Config pointer passed to WithInstance or WithConnection was nil. The driver needs the config (e.g. MigrationsTable) to operate, so it refuses to construct a migration driver without one.","triggerScenarios":"Calling database/sqlite3.WithInstance(db, nil) or WithConnection(conn, nil), or Open-ing a sqlite3 URL when the driver internally builds a nil Config.","commonSituations":"Constructing the driver programmatically without building a Config struct; wiring migrate.NewWithInstance with a hand-rolled source; refactors that accidentally drop the config argument.","solutions":["Pass a non-nil &sqlite3.Config{} (optionally setting MigrationsTable)","Use migrate.Open / database.Open with the sqlite3:// URL so the driver builds the config for you","Check the caller that constructs the Config for a code path returning nil"],"exampleFix":"// before\ndrv, err := sqlite3.WithInstance(db, nil)\n// after\ncfg := &sqlite3.Config{MigrationsTable: \"schema_migrations\"}\ndrv, err := sqlite3.WithInstance(db, cfg)","handlingStrategy":"validation","validationCode":"if cfg == nil {\n    return errors.New(\"sqlite3 driver requires a non-nil Config\")\n}\ndrv, err := sqlite3.WithInstance(db, cfg)","typeGuard":"func configProvided(cfg *sqlite3.Config) bool { return cfg != nil }","tryCatchPattern":null,"preventionTips":["Always construct a Config literal at the call site, never pass a bare nil","Wrap driver construction in a helper that owns default Config values","Run tests against driver setup so nil args fail fast in CI"],"tags":["go","sqlite3","database","migration","nil-config"],"backgroundTag":"nil-config","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}