JosefNemec/Playnite · critical · LiteDB.LiteException
Current data file requires password
Error message
Current data file requires password
What it means
Thrown as LiteDB.LiteException by FileReaderV7 constructor when opening an old (v7 page format / LiteDB v4) database file that has a non-zero encryption salt in its header but no password was supplied. The salt indicates the file was created with password encryption enabled. The reader requires the password to decrypt pages.
Source
Thrown at source/Playnite/Database/Collections/LiteDBFileReaderV7.cs:612
{
// v7 uses 4k page size
private const int V7_PAGE_SIZE = 4096;
private readonly Stream _stream;
private readonly LiteDB.BsonDocument _header;
private byte[] _buffer = new byte[V7_PAGE_SIZE];
public FileReaderV7(Stream stream, string password)
{
_stream = stream;
// only userVersion was avaiable in old file format versions
_header = this.ReadPage(0);
if (password == null && _header["salt"].AsBinary.IsFullZero() == false)
{
throw new LiteDB.LiteException("Current data file requires password");
}
}
/// <summary>
/// Read all collection based on header page
/// </summary>
public IEnumerable<string> GetCollections()
{
return _header["collections"].AsDocument.Keys;
}
/// <summary>
/// Read all indexes from all collection pages
/// </summary>
public IEnumerable<IndexInfo> GetIndexes(string collection)
{
var pageID = (uint)_header["collections"].AsDocument[collection].AsInt32;
var page = this.ReadPage(pageID);View on GitHub (pinned to 5911f4e964)
Solutions
- Provide the database password to the migration/open API: ensure the password collection or prompt is wired into the FileReaderV7 constructor call.
- If the password is known, enter it in Playnite's database settings before attempting migration.
- If the password is lost, the database cannot be decrypted; restore from an unencrypted backup if available.
- Disable encryption on the old Playnite install (if still accessible) before migrating: export data, create a new unencrypted DB, re-import.
Example fix
// before — opening encrypted DB without password var reader = new FileReaderV7(stream, password: null); // throws // after — prompt for or retrieve password before opening string password = await PromptUserForDbPassword(); var reader = new FileReaderV7(stream, password);
Defensive patterns
Strategy: validation
Validate before calling
// FileReaderV7 checks salt internally; pre-validate at the caller: // Read the salt bytes from the header page before constructing FileReaderV7 byte[] headerPage = new byte[4096]; stream.Position = 0; stream.Read(headerPage, 0, 4096); // If salt (at its known offset) is non-zero, prompt for password before constructing the reader.
Try / catch
try
{
var reader = new FileReaderV7(stream, password);
}
catch (LiteDB.LiteException ex) when (ex.Message.Contains("requires password"))
{
password = Dialogs.ShowInput("Database Password", "Enter the database password:");
var reader = new FileReaderV7(stream, password);
} Prevention
- Before migration, check if the database was encrypted (non-zero salt in header).
- Prompt for password interactively when the salt indicates encryption.
- Store the database password in the OS credential store for automatic migration.
When it happens
Trigger: Migrating an encrypted old-format Playnite database without providing the password. The FileReaderV7(stream, password) constructor checks if the header's salt field is non-zero (indicating encryption) and password is null. This fires before any page decryption is attempted.
Common situations: The user had password protection enabled in an old Playnite version and is now migrating. The password was lost or forgotten. The migration code path does not prompt for or pass the database password. A portable/roaming database was moved to a new Playnite install without the password.
Related errors
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/29dbc4fdadbafba1.
Report an issue: GitHub.