Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database disk image malformed after system crash #5558

Open
archaengel opened this issue Jan 26, 2025 · 2 comments
Open

Database disk image malformed after system crash #5558

archaengel opened this issue Jan 26, 2025 · 2 comments
Labels

Comments

@archaengel
Copy link

Describe and demonstrate the bug
I don't think a transcript is applicable here. My machine crashed while I was working on my codebase and attempting to start ucm backup I was greeted with this message

Uh oh, an unexpected exception brought the process down! That should never happen. Please file a bug report.

Here's a stringy rendering of the exception:

  SqliteQueryException {sql = "SELECT version FROM schema_version", params = [], exception = SQLite3 returned ErrorCorrupt while attempting to perform prepare "SELECT version FROM schema_version": database disk image is malformed, callStack = [("throwSqliteQueryException",SrcLoc {srcLocPackage = "unison-sqlite-0.0.0-EM4axGKNyuM52uN6Ok9c4z", srcLocModule = "Unison.Sqlite.Connection", srcLocFile = "src/Unison/Sqlite/Connection.hs", srcLocStartLine = 220, srcLocStartCol = 9, srcLocEndLine = 220, srcLocEndCol = 34}),("queryListRow",SrcLoc {srcLocPackage = "unison-sqlite-0.0.0-EM4axGKNyuM52uN6Ok9c4z", srcLocModule = "Unison.Sqlite.Connection", srcLocFile = "src/Unison/Sqlite/Connection.hs", srcLocStartLine = 283, srcLocStartCol = 9, srcLocEndLine = 283, srcLocEndCol = 21}),("gqueryListCheck",SrcLoc {srcLocPackage = "unison-sqlite-0.0.0-EM4axGKNyuM52uN6Ok9c4z", srcLocModule = "Unison.Sqlite.Connection", srcLocFile = "src/Unison/Sqlite/Connection.hs", srcLocStartLine = 274, srcLocStartCol = 3, srcLocEndLine = 274, srcLocEndCol = 18}),("queryListRowCheck",SrcLoc {srcLocPackage = "unison-sqlite-0.0.0-EM4axGKNyuM52uN6Ok9c4z", srcLocModule = "Unison.Sqlite.Connection", srcLocFile = "src/Unison/Sqlite/Connection.hs", srcLocStartLine = 257, srcLocStartCol = 3, srcLocEndLine = 257, srcLocEndCol = 20}),("queryOneRow",SrcLoc {srcLocPackage = "unison-sqlite-0.0.0-EM4axGKNyuM52uN6Ok9c4z", srcLocModule = "Unison.Sqlite.Connection", srcLocFile = "src/Unison/Sqlite/Connection.hs", srcLocStartLine = 263, srcLocStartCol = 41, srcLocEndLine = 263, srcLocEndCol = 52}),("queryOneCol",SrcLoc {srcLocPackage = "unison-sqlite-0.0.0-EM4axGKNyuM52uN6Ok9c4z", srcLocModule = "Unison.Sqlite.Transaction", srcLocFile = "src/Unison/Sqlite/Transaction.hs", srcLocStartLine = 289, srcLocStartCol = 24, srcLocEndLine = 289, srcLocEndCol = 46}),("queryOneCol",SrcLoc {srcLocPackage = "unison-codebase-sqlite-0.0.0-GO3bVQgu5bqI4cVjIguow2", srcLocModule = "U.Codebase.Sqlite.Queries", srcLocFile = "./U/Codebase/Sqlite/Queries.hs", srcLocStartLine = 491, srcLocStartCol = 3, srcLocEndLine = 491, srcLocEndCol = 14})], connection = Connection { name = "main", file = "/Users/god/.unison/v2/unison.sqlite3" }, threadId = ThreadId 12}

I'm aware there may not be much hope given this happened due to a system crash but reporting here for posterity

Environment (please complete the following information):

  • ucm --version unison version: release/0.5.29 (built on 2024-12-02)
  • OS/Architecture: macOS 13.6.7, Intel
@archaengel archaengel added the bug label Jan 26, 2025
@archaengel
Copy link
Author

I was able to recover the db by running

cd ~/.unison/v2
sqlite3 unison.sqlite3 .recover | sqlite3 unison.sqlite3.recovered
mv unison.sqlite3 unison.sqlite3.corrupted_bak
mv unison.sqlite3.recovered unison.sqlite3

@aryairani
Copy link
Contributor

Wow, that is kind of surprising. I'm not sure if we can do anything about it as it seems like a sqlite issue, but we'll discuss it.

Thanks for reporting and I'm glad you were able to recover your database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants