Sqlcipher Error: malformed database schema (with table name in it)

I am trying to open the sqlcipher db, but have an error:

Error: malformed database schema (sqlcph_autoindex_first_table_1) - orphan index

This db have the same params as I’ve set. And in error appears name of table, that exists in source database: first_table

sqlite> .open testdb.db
sqlite> PRAGMA key = “x’7113B06B31E7DF37FE1BCEE33F2D91B7EA56FA3169E6AC8661F6ABEA690F4FBE’”;
sqlite> PRAGMA cipher_page_size = 1024;
sqlite> PRAGMA kdf_iter = 64000;
sqlite> PRAGMA cipher_hmac_algorithm = HMAC_SHA1;
sqlite> PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;
sqlite> .tables
Error: malformed database schema (sqlcph_autoindex_first_table_1) - orphan index

Hi @evtromand

It might be worth trying to run the newer .recover command from the command line to see if your database can be repaired.

@evtromand - how was the database created? There should not be any symbols starting with sqlcph. Was it created using a custom build of SQLCipher from source?

Thx, it works! I also have advice to dump it and write to new database. That works too. I gues that’s the same as .recovery

sqlite> .output test.txt
sqlite> .dump
cat test.txt | sqlcipher database.sqlite