SQLite Database File Corruption When Opened In Repl.it Online Text Editor

Problem description:
Opening a database file created through the sqlite3 package in python in repl.it online text editor automatically modifies and saves its contents without user intervention. This seems to corrupt the database file, making it unavailable to be opened in a database browser.

Expected behavior:
That opening the file in the text editor does not modify its original contents unless the user edits it themselves. The database file should open in the database browser without any errors:

Actual behavior:
The database file is automatically modified and saved without user input. When opened in a database browser, in this case DB Browser for SQLite, the following error appears:

There is also file size difference between the opened and unopened file:

Steps to reproduce:
Create an database file through Python’s sqlite3 package.

Open the database file in the repl.it online editor.

Download and open the database file in a database browser such as DB Browser for SQLite.

Bug appears at this link:

Chromium Browser
Windows 10 Pro
Ryzen 7 5800H/16GB SODIMM-DDR4 3200/RTX 3050 Laptop

Hey @ElianBrito!

If you open up the history for the db file, does it provide any entries that you can restore to?

If so, you can try restoring to one of the versions then downloading the file again


Hello @ShaneAtReplit !

Sorry for the late response. But I tried out your solution and restored the file to it’s first iteration through the history tab. Sadly, it still gave the same error.

The history showed that I accidentally modified the file once by appending the ‘f’ character to line 1. But I already removed that mistake before and I’ve restored file to the server authored version as well.

I do want to note that although the file had been deleted and recreated, history from it’s previous existence still is present. I just want to confirm if that’s normal behavior.

Also I tried changing the name of the file by appending “_1.” It did seem to separate it’s history from the previous file name, however, it still had the same error in the DB browser.


Firstly, yes, history will stick around even if you delete the file. This makes it easy to restore a file if you accidentally delete it. Secondly, if you aren’t able to find a viable version of the database from the history, there isn’t much we can do about this. The only thing we can recommend is to not open up binary or unsupported files in Replit due to unintended issues such as this.

I will let the team know about the case that opening up the SQLite DB in Replit corrupts it so we can work on resolving this.

Sent from Front

1 Like

Alright, thank you so much for your help. I will let others know about this in the future.