{"record":{"id":"00f9b8ffe98b6130","repo":"golang-migrate/migrate","slug":"no-config-00f9b8","errorCode":null,"errorMessage":"no config","messagePattern":"no config","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/ql/ql.go","lineNumber":24,"sourceCode":"\t\"fmt\"\n\t\"io\"\n\tnurl \"net/url\"\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_ \"modernc.org/ql/driver\"\n)\n\nfunc init() {\n\tdatabase.Register(\"ql\", &Ql{})\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\tErrAppendPEM      = fmt.Errorf(\"failed to append PEM\")\n)\n\ntype Config struct {\n\tMigrationsTable string\n\tDatabaseName    string\n}\n\ntype Ql 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":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/ql/ql.go#L6-L42","documentation":"ErrNilConfig is a sentinel error returned by the ql driver's WithInstance and WithConnection when the *Config argument is nil. The driver requires a non-nil config (even if only a MigrationsTable default is applied from it) to initialize. Cassandra and redshift redeclare the same sentinel for their own WithInstance functions.","triggerScenarios":"Calling database.WithInstance(instance, nil) or ql.WithConnection(conn, nil) without constructing a Config struct.","commonSituations":"Programmatic use of the driver without the URL-based Open path, e.g. embedding migrate in an application and forgetting to build the Config; refactors that drop the config argument.","solutions":["Pass a non-nil &ql.Config{} — at minimum &ql.Config{MigrationsTable: ql.DefaultMigrationsTable}","Include the required DatabaseName value in the config if using WithInstance","Prefer the Open(dsn) path so the driver builds the config from the URL"],"exampleFix":"// before\ndriver, err := ql.WithInstance(instance, nil)\n// after\ndriver, err := ql.WithInstance(instance, &ql.Config{DatabaseName: \"mydb\", MigrationsTable: ql.DefaultMigrationsTable})","handlingStrategy":"validation","validationCode":"func validateQLConfig(cfg *ql.Config) error {\n    if cfg == nil {\n        return errors.New(\"ql config must not be nil\")\n    }\n    if cfg.MigrationsTable == \"\" {\n        cfg.MigrationsTable = ql.DefaultMigrationsTable\n    }\n    return nil\n}","typeGuard":"func hasConfig(cfg *ql.Config) bool { return cfg != nil }","tryCatchPattern":null,"preventionTips":["Always construct Config via a constructor/helper that fills defaults","Prefer Open(dsn) so the driver assembles the config itself","Add a nil check for config in wrappers around WithInstance"],"tags":["ql","configuration","nil-pointer","validation"],"backgroundTag":"nil-config","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}