Skip to content

Database Error

Sometimes, you may see the following error message:

This indicates that a database error has occurred, and it is recommended to handle it immediately.

WonderPen’s library content is stored in a SQLite database. Generally speaking, SQLite is very reliable, but if multiple programs read and write to it, there is a certain probability of errors. For example, if you put a local library into a third-party cloud drive, and the third-party cloud drive has a conflict during synchronization, it may corrupt the database file.

Don’t panic when encountering this problem. WonderPen has built-in automatic data backup enabled by default. Database corruption will not affect existing backup files, and you can restore data from backups at any time.

There are usually three ways to handle database errors.

Sometimes, this error is temporary, and exiting and restarting WonderPen can restore normal operation.

If the error still appears after restarting, please continue with the methods below.

In most cases, you can try to restore from backup, which may fix the database.

As shown in the figure above, open the backup and restore panel, and click the restore button on the right side of the latest backup to restore the data.

If no error message appears after restoring the data, it means the database has returned to normal.

If you still see error messages, please try the method below.

3️⃣ Delete the local database file, then restore from backup

Section titled “3️⃣ Delete the local database file, then restore from backup”

If direct restoration cannot fix the database, you need to first delete the local database file (or, more safely: rename it or move it to another location), and then try to restore from backup.

The specific steps are as follows:

  1. Exit WonderPen

    To delete the current library database, you need to exit WonderPen first, otherwise the database file may still be in use and deletion may fail.

  2. Open the library folder

    Open the folder where the current library is located. Library folders generally end with .wplibrary.

  3. Delete (or rename, move) the database file

    In the library folder (.wplibrary folder), you should be able to see a data.db file. The directory structure is similar to the following:

    My Library.wplibrary/
    ├── assets/
    ├── backup/
    ├── db/
    ├── data.db  <-- Focus on this file
    └── ...

    Note that there may be other files in your library directory, but you don’t need to pay attention to other files, just focus on that data.db file.

    If your system hides file extensions, you may only see a file named data.

    Next, you can delete this data.db file. Of course, to be safe, you can also rename this file or move it to another location so that you can restore it if needed.

    If you see other files starting with data in this directory, such as data.db-shm, data.db-wal, you can delete (or rename, move) them together.

  4. Open WonderPen and restore from backup again

    Then, please reopen WonderPen and open this library. At this time, the library should appear empty.

    Finally, please restore from backup again, and the library should return to normal.

If you still encounter problems, please contact us via Email or other methods.

Some common error codes:

codeMeaningCommon scenarios
SQLITE_INTERNALInternal logic errorSQLite internal bug (very rare)
SQLITE_PERMPermission errorUnable to write to database file
SQLITE_ABORTOperation abortedTransaction manually aborted
SQLITE_BUSYDatabase lockedMultiple processes writing to database simultaneously
SQLITE_LOCKEDDatabase file lock conflictLock contention within the same connection
SQLITE_NOMEMOut of memoryInsufficient system resources
SQLITE_READONLYRead-only databaseDatabase opened in read-only mode
SQLITE_IOERRI/O errorDisk read/write error
SQLITE_CORRUPTDatabase corruptedFile corruption, “database disk image is malformed”
SQLITE_NOTFOUNDFile not foundDatabase or index missing
SQLITE_FULLDisk fullWrite failed
SQLITE_CANTOPENUnable to open databaseFile path error or insufficient permissions
SQLITE_EMPTYDatabase emptyReading empty file
SQLITE_TOOBIGData too largeInserting very long string or blob
SQLITE_NOLFSLarge file not supportedRare case
SQLITE_FORMATFile format errorSQLite version incompatibility
SQLITE_NOTADBNot a SQLite fileThe opened file is not a database