Restarting your Arch Linux system after a power outage often leaves Electron-based applications like GitHub Desktop in a locked state. The "Cannot create an item in a locked collection" error occurs because the application’s internal database files remain open or corrupted from the abrupt shutdown. You can resolve this by safely clearing the local cache and configuration data, forcing the app to rebuild its state upon the next launch.
Understanding the Error
GitHub Desktop is built on Electron, which relies heavily on IndexedDB for storing user preferences, repository states, and authentication tokens locally. When a power outage occurs unexpectedly, the operating system may not have enough time to gracefully close these database connections. Consequently, when you attempt to restart the application, it finds the underlying storage files in a "locked" or inconsistent state. This prevents the creation of new items or updates to existing collections, resulting in the specific error message you are seeing. This issue is distinct from hardware failures. While we recommend checking your system health after unexpected reboots, as discussed in Troubleshooting Occurred Disk Power-On Lifetime Errors on Arch Linux PC, this specific software error is almost always related to file locks rather than disk damage. The system itself is likely fine; only the application's local state needs resetting.Step-by-Step Resolution
To fix this, you must remove the corrupted local data that GitHub Desktop uses. Since the application is currently failing to launch or sign in, you need to do this manually via the terminal. Please follow these steps carefully to ensure you do not delete any important Git repositories stored elsewhere on your system.1. Close GitHub Desktop Completely
Ensure that GitHub Desktop is not running in the background. Sometimes, even if the window is closed, the process persists. Open your terminal and run the following command to kill any lingering processes:killall github-desktop
If the command returns no output, the process has been terminated. If it complains about the process not being found, that is also acceptable, as it means the app is already closed.
2. Remove the Application State
The core of the problem lies in the XDG data directory where Electron apps store their persistent data. On Arch Linux, this is typically located under~/.local/share. You need to rename or remove the GitHub Desktop folder here. This action will clear the lock and force the application to create a fresh database structure.
Run the following commands in your terminal:
mv ~/.local/share/GitHub\ Desktop ~/.local/share/GitHub\ Desktop.bak
Using mv (move) instead of rm (remove) is a safety precaution. It creates a backup named .bak. If something goes wrong or you need to recover old settings later, the original data is still there. If you are confident in the fix, you can delete it entirely with rm -rf ~/.local/share/GitHub\ Desktop, but moving it is safer.
3. Clear the Configuration Cache
In addition to the shared data, Electron apps often store configuration flags and caches in the XDG config directory. While less likely to cause the "locked collection" error, clearing this ensures a clean slate. Run the following command:rm -rf ~/.config/GitHub\ Desktop
Again, this removes all local settings, including your remembered login status and UI preferences. You will need to log in again after the fix.
4. Restart GitHub Desktop
Now that the corrupted files have been removed, launch GitHub Desktop normally from your application menu or by typinggithub-desktop in the terminal. The application should start up as if it were installed for the first time. You will be prompted to sign in to your GitHub account again. Once authenticated, the app will recreate the necessary database files with proper permissions and no locks.
Preventing Future Occurrences
While this fix resolves the immediate issue, repeated power outages can lead to more severe system corruption. To mitigate risks, consider using an Uninterruptible Power Supply (UPS) for your desktop or laptop. Additionally, ensure your Arch Linux system is fully updated, as kernel updates often include improvements to filesystem handling during abrupt shutdowns. If you experience other graphical interface issues after a reboot, such as display problems, you might find relevant guidance in Grub not shown on external screen after installing Arch Linux on old laptop, although this specific issue is unrelated to network or application state. For general system stability, always prioritize safe shutdown procedures over hard resets.Alternative Approaches
If the above steps do not resolve the issue, the problem may lie deeper within the Snap or Flatpak packages if you installed GitHub Desktop via those methods. Arch Linux users typically install via official repositories or AUR, but if you used a universal package format, the path to the data directory will differ. For Snap installations, the data is located at~/snap/github-desktop/common/. For Flatpak, it is at ~/.var/app/com.github.GitHubDesktop/. Removing the corresponding directories in these paths follows the same logic as the native installation method described above. However, native Arch packages are recommended for better integration with system libraries and fewer permission quirks.
When to Worry About Hardware
It is important to distinguish between software state errors and actual hardware failure. If you see I/O errors in your system logs (dmesg) or if other applications fail to write to disk, the power outage may have damaged your storage drive. In such cases, running a filesystem check with fsck is necessary before attempting to fix individual applications. However, if only GitHub Desktop fails while other apps work normally, the solution is strictly confined to the application's local cache, as detailed in this guide.
Frequently Asked Questions
Will deleting these folders delete my git repositories?
No, deleting the GitHub Desktop cache and configuration does not affect your local git repositories. Your code remains safe in the directories where you cloned them. This process only removes the application's memory of your login state and UI preferences.Why did this happen after a power outage specifically?
Power outages prevent graceful shutdown sequences. Applications like GitHub Desktop keep database files open in memory. When power is cut, these files are left in a "locked" state by the operating system, causing conflicts when the app tries to reopen them immediately.Can I recover my previous settings?
If you moved the folder to.bak as suggested, you can inspect the backup for specific configuration files you wish to restore. However, most settings are simple defaults, so starting fresh is usually faster and cleaner than trying to merge partial configs.
What if the error persists after clearing the cache?
If the error continues, try reinstalling GitHub Desktop completely. Usepacman -Rns github-desktop followed by pacman -S github-desktop to ensure all binary components are refreshed alongside the cleared data.
Does this affect GitHub CLI (gh)?
No, the GitHub CLI stores its credentials separately in~/.config/gh/ or uses the system keyring. Fixing GitHub Desktop does not impact the command-line tool's authentication status.