{"record":{"id":"8eb276e5f8ce1de1","repo":"golang-migrate/migrate","slug":"bad-parameter","errorCode":null,"errorMessage":"bad parameter","messagePattern":"bad parameter","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/rqlite/rqlite.go","lineNumber":33,"sourceCode":")\n\nfunc init() {\n\tdatabase.Register(\"rqlite\", &Rqlite{})\n}\n\nconst (\n\t// DefaultMigrationsTable defines the default rqlite migrations table\n\tDefaultMigrationsTable = \"schema_migrations\"\n\n\t// DefaultConnectInsecure defines the default setting for connect insecure\n\tDefaultConnectInsecure = false\n)\n\n// ErrNilConfig is returned if no configuration was passed to WithInstance\nvar ErrNilConfig = fmt.Errorf(\"no config\")\n\n// ErrBadConfig is returned if configuration was invalid\nvar ErrBadConfig = fmt.Errorf(\"bad parameter\")\n\n// Config defines the driver configuration\ntype Config struct {\n\t// ConnectInsecure sets whether the connection uses TLS. Ineffectual when using WithInstance\n\tConnectInsecure bool\n\t// MigrationsTable configures the migrations table name\n\tMigrationsTable string\n}\n\ntype Rqlite struct {\n\tdb       *gorqlite.Connection\n\tisLocked atomic.Bool\n\n\tconfig *Config\n}\n\n// WithInstance creates a rqlite database driver with an existing gorqlite database connection\n// and a Config struct","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/rqlite/rqlite.go#L15-L51","documentation":"ErrBadConfig (message \"bad parameter\") is the rqlite driver's generic configuration error. parseUrl and parseConfigFromQuery wrap it with %w for specific failures: a non-rqlite URL scheme, an x-migrations-table query param starting with sqlite_, or a non-boolean x-connect-insecure value. Because it is always wrapped, use errors.Is(err, rqlite.ErrBadConfig) to detect it and read the wrapper text for the exact cause.","triggerScenarios":"Opening rqlite://... with the wrong scheme; passing x-migrations-table=sqlite_foo in the URL query; passing x-connect-insecure=yes/no-on-off-nonbool (anything strconv.ParseBool rejects, e.g. \"yes\" or \"2\").","commonSituations":"Reusing a connection URL from an http/https-based client and forgetting the scheme must be exactly rqlite; copying SQLite migration table naming conventions (sqlite_*) into rqlite; hand-writing the DSN with an unchecked boolean param.","solutions":["Fix the specific part named in the wrapped error text: scheme, x-migrations-table, or x-connect-insecure","Use scheme rqlite (or rqlites for TLS) in the URL — Open adapts it to http/https internally","Choose a migrations table name that does not start with sqlite_","Use a value strconv.ParseBool accepts for x-connect-insecure: 1/t/T/TRUE/true/True/0/f/F/FALSE/false/False","In Go code, branch on errors.Is(err, rqlite.ErrBadConfig) to report a config problem rather than a connection problem"],"exampleFix":"// before\nurl := \"https://localhost:4001/db?x-connect-insecure=yes\"\n// after\nurl := \"rqlite://localhost:4001/db?x-connect-insecure=true\"","handlingStrategy":"validation","validationCode":"u, err := url.Parse(dsn)\nif err != nil { return err }\nif u.Scheme != \"rqlite\" { return fmt.Errorf(\"scheme must be rqlite, got %q\", u.Scheme) }\nq := u.Query()\nif t := q.Get(\"x-migrations-table\"); strings.HasPrefix(t, \"sqlite_\") { return fmt.Errorf(\"x-migrations-table cannot start with sqlite_\") }\nif v := q.Get(\"x-connect-insecure\"); v != \"\" {\n    if _, err := strconv.ParseBool(v); err != nil { return fmt.Errorf(\"x-connect-insecure must be a Go bool\") }\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if errors.Is(err, rqlite.ErrBadConfig) {\n        log.Fatalf(\"rqlite driver misconfiguration: %v\", err)\n    }\n    return err\n}","preventionTips":["Always use the rqlite:// scheme in DSNs, never http(s)","Never name migrations tables with a sqlite_ prefix in this driver","Only use Go strconv.ParseBool-accepted literals for boolean query params","Detect this family with errors.Is(err, rqlite.ErrBadConfig)"],"tags":["go","golang-migrate","rqlite","config","url-parsing"],"backgroundTag":"invalid-dsn-parameter","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}