{"record":{"id":"c7f0a154ec09f972","repo":"golang-migrate/migrate","slug":"x-no-tx-wrap-s-c7f0a1","errorCode":null,"errorMessage":"x-no-tx-wrap: %s","messagePattern":"x-no-tx-wrap: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/sqlite3/sqlite3.go","lineNumber":112,"sourceCode":"\t}\n\tdbfile := strings.Replace(migrate.FilterCustomQuery(purl).String(), \"sqlite3://\", \"\", 1)\n\tdb, err := sql.Open(\"sqlite3\", dbfile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqv := purl.Query()\n\n\tmigrationsTable := qv.Get(\"x-migrations-table\")\n\tif len(migrationsTable) == 0 {\n\t\tmigrationsTable = DefaultMigrationsTable\n\t}\n\n\tnoTxWrap := false\n\tif v := qv.Get(\"x-no-tx-wrap\"); v != \"\" {\n\t\tnoTxWrap, err = strconv.ParseBool(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"x-no-tx-wrap: %s\", err)\n\t\t}\n\t}\n\n\tmx, err := WithInstance(db, &Config{\n\t\tDatabaseName:    purl.Path,\n\t\tMigrationsTable: migrationsTable,\n\t\tNoTxWrap:        noTxWrap,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn mx, nil\n}\n\nfunc (m *Sqlite) Close() error {\n\treturn m.db.Close()\n}\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/sqlite3/sqlite3.go#L94-L130","documentation":"Returned by Open in database/sqlite3/sqlite3.go when the x-no-tx-wrap query parameter is present in the sqlite:// URL but its value cannot be parsed as a boolean by strconv.ParseBool (e.g. x-no-tx-wrap=yes instead of true/false/1/0). It signals that the connection URL is malformed for this option; fix by supplying a valid boolean value for x-no-tx-wrap.","triggerScenarios":"Opening a URL like 'sqlite3://app.db?x-no-tx-wrap=yes!' or any value other than 1/t/T/true/TRUE/True/0/f/F/false/FALSE/False.","commonSituations":"Typos in the query value ('ture', 'on', 'yes'); generating the URL programmatically with a non-bool string; copying examples with placeholder values.","solutions":["Set x-no-tx-wrap to a strconv.ParseBool-accepted value: true/false/1/0/t/f/T/F/TRUE/FALSE/True/False","Remove the x-no-tx-wrap query parameter if you want the default (transactions wrapped)","Log/print the final URL and validate the query string before passing it to Open"],"exampleFix":"// before\nmigrate.Open(\"sqlite3://app.db?x-no-tx-wrap=enabled\")\n// after\nmigrate.Open(\"sqlite3://app.db?x-no-tx-wrap=true\")","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(dsn)\nif v := u.Query().Get(\"x-no-tx-wrap\"); v != \"\" {\n    if _, err := strconv.ParseBool(v); err != nil {\n        return fmt.Errorf(\"invalid x-no-tx-wrap %q: %w\", v, err)\n    }\n}","typeGuard":"func validBoolParam(v string) bool { _, err := strconv.ParseBool(v); return v == \"\" || err == nil }","tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"x-no-tx-wrap\") {\n        return fmt.Errorf(\"bad x-no-tx-wrap value in DSN %q: %w\", dsn, err)\n    }\n    return err\n}","preventionTips":["Build DSNs with url.Values.Encode() instead of string concatenation","Keep boolean DSN options as bool variables and format with %t","Add a unit test that parses your production DSN"],"tags":["go","sqlite3","database","url-parameter","invalid-boolean"],"backgroundTag":"invalid-url-query-param","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}