JosefNemec/Playnite · critical · Exception
Can't write to "{DatabasePath}" folder.
Error message
Can't write to "{DatabasePath}" folder. What it means
Thrown as a generic Exception by GameDatabase.OpenDatabase() when FileSystem.CanWriteToFolder(DatabasePath) returns false. The database directory must be writable for Playnite to store game data, files, and settings. Read-only locations (locked folders, protected system directories, read-only network shares) cause this error.
Source
Thrown at source/Playnite/Database/GameDatabase.cs:514
else
{
return path;
}
}
public void OpenDatabase()
{
if (string.IsNullOrEmpty(DatabasePath))
{
throw new Exception("Database path cannot be empty.");
}
var dbExists = File.Exists(DatabaseFileSettingsPath);
logger.Info("Opening db " + DatabasePath);
if (!FileSystem.CanWriteToFolder(DatabasePath))
{
throw new Exception($"Can't write to \"{DatabasePath}\" folder.");
}
// This fixes an issue where people mess up their library with custom scripts
// which create collection files instead of directories :|
if (File.Exists(FilesDirectoryPath))
{
File.Delete(FilesDirectoryPath);
}
if (!dbExists)
{
FileSystem.CreateDirectory(DatabasePath);
FileSystem.CreateDirectory(FilesDirectoryPath);
}
if (!dbExists)
{
Settings = new DatabaseSettings() { Version = NewFormatVersion };
View on GitHub (pinned to 5911f4e964)
Solutions
- Move the database to a writable directory (e.g., %AppData%\Playnite or a local user folder).
- Fix folder permissions: right-click the folder > Properties > Security > grant the current user Write permission.
- If on a network share, ensure the share is mounted with read-write access.
- Disable write-protection on USB/removable media.
- If cloud sync is interfering, exclude the database folder or move it outside the sync root.
Example fix
// before — database path on a read-only share
gameDatabase.DatabasePath = @"\\server\share\PlayniteDB";
gameDatabase.OpenDatabase(); // throws
// after — use a writable local path
gameDatabase.DatabasePath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Playnite", "database");
gameDatabase.OpenDatabase(); Defensive patterns
Strategy: validation
Validate before calling
if (!FileSystem.CanWriteToFolder(gameDatabase.DatabasePath))
{
logger.Error($"Cannot write to database folder: {gameDatabase.DatabasePath}");
// fall back to default AppData path or prompt user for a new location
gameDatabase.DatabasePath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Playnite", "database");
} Prevention
- Use a writable local directory for the database (AppData or user home).
- Avoid network shares, cloud-sync folders, and read-only media for database storage.
- Check folder write permissions during startup and warn the user early.
When it happens
Trigger: DatabasePath points to a read-only directory, a folder the current user lacks write permissions for, a read-only mounted network share, or a folder locked by another process. CanWriteToFolder attempts a test write and it fails.
Common situations: Database is on a read-only network share or USB drive with write protection. The folder is owned by another user or SYSTEM with no write ACL for the current user. Antivirus or ransomware protection blocks writes to the folder. The path is inside Program Files without elevation. Cloud sync (OneDrive/Dropbox) created a read-only placeholder.
Related errors
- Cannot add file to database, file not found.
- Database path cannot be empty.
- Backup output path not specified!
- Failed to read {path}
- Failed to write to {path}
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/d66dc43e1859e378.
Report an issue: GitHub.