{"record":{"id":"5f5a20a63201d4a2","repo":"gastownhall/beads","slug":"unsupported-legacy-sqlite-release-q","errorCode":null,"errorMessage":"unsupported legacy SQLite release %q","messagePattern":"unsupported legacy SQLite release %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/migration/legacysqlite/reader.go","lineNumber":312,"sourceCode":"\tif err := tx.Commit(); err != nil {\n\t\treturn err\n\t}\n\tenc := json.NewEncoder(out)\n\tfor _, issue := range issues {\n\t\tif err := enc.Encode(issue); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc verify(ctx context.Context, db *sql.Tx) error {\n\tvar version string\n\tif err := db.QueryRowContext(ctx, \"SELECT value FROM metadata WHERE key = 'bd_version'\").Scan(&version); err != nil {\n\t\treturn fmt.Errorf(\"legacy SQLite release marker: %w\", err)\n\t}\n\tif !acceptedVersions[version] {\n\t\treturn fmt.Errorf(\"unsupported legacy SQLite release %q\", version)\n\t}\n\tfor table, want := range schema {\n\t\tif err := verifyTable(ctx, db, table, want); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, table := range []string{\"metadata\", \"issues\", \"dependencies\", \"labels\", \"comments\"} {\n\t\tif err := verifyFKs(ctx, db, table); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc verifyTable(ctx context.Context, db *sql.Tx, table, want string) error {\n\trows, err := db.QueryContext(ctx, \"PRAGMA table_xinfo(\"+table+\")\")\n\tif err != nil {\n\t\treturn err","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/migration/legacysqlite/reader.go#L294-L330","documentation":"After reading bd_version from the metadata table, verify() checks it against acceptedVersions, an explicit allow-list (currently {\"0.49.6\",\"0.50.3\"}). Any other value — older or newer bd releases, or garbage — yields 'unsupported legacy SQLite release %q'. The package migrates only exact, audited contracts, so unknown releases are rejected rather than guessed at.","triggerScenarios":"Export -> read -> verify where the metadata bd_version value is not in acceptedVersions — e.g. version \"0.48.2\", a future version like \"0.51.0\", or an empty/corrupted marker string.","commonSituations":"Migrating a database produced by a much older or newer bd release than this binary supports; a hand-edited metadata table; upgrading bd before finishing migration of old repos.","solutions":["Check the version: sqlite3 beads.db \"SELECT value FROM metadata WHERE key='bd_version'\" and compare with the accepted list for this build","Use a bd release whose acceptedVersions includes your database's version to run the migration","If on a newer version, first migrate intermediate steps with the appropriate older bd release, or wait for/upgrade to a build that accepts it","If the value looks corrupted, restore the database from backup"],"exampleFix":"$ sqlite3 beads.db \"SELECT value FROM metadata WHERE key='bd_version';\"\n0.48.2\n// error: unsupported legacy SQLite release \"0.48.2\"\n// fix: run the migration with a bd release that accepts 0.48.2 (e.g. bd 0.49.x) first,\n// or upgrade the database through the intermediate supported versions","handlingStrategy":"validation","validationCode":"// pre-flight: check bd_version against your build's accepted list\nfunc checkAcceptedVersion(dbPath string, accepted map[string]bool) error {\n\tdb, err := sql.Open(\"sqlite3\", dbPath+\"?mode=ro\"); if err != nil { return err }\n\tdefer db.Close()\n\tvar v string\n\tif err := db.QueryRow(\"SELECT value FROM metadata WHERE key='bd_version'\").Scan(&v); err != nil { return err }\n\tif !accepted[v] { return fmt.Errorf(\"bd_version %q not accepted by this build; use a matching bd release\", v) }\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"if err := legacysqlite.Export(ctx, src, out, os.Stdout); err != nil {\n\tif strings.Contains(err.Error(), \"unsupported legacy SQLite release\") {\n\t\treturn fmt.Errorf(\"run the migration with the bd release matching the database version (see metadata.bd_version)\")\n\t}\n\treturn err\n}","preventionTips":["Record bd_version of legacy databases and migrate with a bd build that accepts it","Don't hand-edit the metadata table; a corrupted version string blocks migration","Upgrade databases stepwise through supported intermediate versions","Check release notes for the accepted legacy versions before upgrading bd in place"],"tags":["sqlite","migration","versioning","compatibility"],"backgroundTag":"unsupported-database-version","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}