Flatpak is a popular package management system, but sometimes updates fail due to corrupted files. If you see errors like "opcode close: Corrupted file object" or "Deleting ref due to invalid objects" while updating or repairing Flatpak apps, don’t worry. This guide will walk you through troubleshooting and fixing these issues step by step.
The problem - Flatpak corrupted file object
The other day I tried to update my flatpak apps using command:
flatpak update
I encountered with this error:
ID Branch Op Remote Download 1. [✗] org.freedesktop.Platform 23.08 u flathub 884.4 kB / 231.2 MB 2. [✗] org.kde.Platform 5.15-23.08 u flathub 1.1 MB / 343.5 MB Error: While pulling runtime/org.freedesktop.Platform/x86_64/23.08 from remote flathub: opcode close: Corrupted file object; checksum expected='b08d64b3e079ae0438d93325c280770f42bfba20797560d76f00c6507a524c5b' actual='b4e881ffeaa6631b9d10357405f9304c120c0aee3881a81a261927cf4c143274' Error: While pulling runtime/org.kde.Platform/x86_64/5.15-23.08 from remote flathub: opcode close: Corrupted file object; checksum expected='b08d64b3e079ae0438d93325c280770f42bfba20797560d76f00c6507a524c5b' actual='b4e881ffeaa6631b9d10357405f9304c120c0aee3881a81a261927cf4c143274' Updates complete. error: There were one or more errors"
Then, I ran the flatpak repair command, but no luck! I get the same error every time.
If you encounter errors while updating Flatpak apps—such as:
Error: While pulling runtime/org.freedesktop.Platform/x86_64/23.08 from remote flathub: opcode close: Corrupted file object
or when running flatpak repair, it reports:
Dry run: Deleting ref flathub:runtime/org.freedesktop.Platform/x86_64/23.08 due to invalid objects
this guide will walk you through troubleshooting and resolving the issue.
Common Causes of Flatpak Update Errors
- Corrupt Flatpak runtime files: Unexpected shutdowns or failed downloads can corrupt files.
- Checksum mismatch: The downloaded file doesn’t match the expected hash.
- Low disk space: Flatpak updates may fail if your system is running out of storage.
- Flathub mirror issues: A temporary issue with Flathub can cause download errors.
Fix Flatpak Corrupted File Object Issue
1. Try Repairing Flatpak
First, run:
sudo flatpak repair --system
This command checks and attempts to fix corrupted files. If it reports invalid objects in a "dry run," you need to manually remove them.
2. Remove Corrupt Runtimes
If flatpak repair fails to fix the issue, force-remove the problematic runtimes:
sudo flatpak uninstall --force-remove org.freedesktop.Platform//23.08 org.kde.Platform//5.15-23.08
Then, remove unused runtimes:
sudo flatpak uninstall --unused
3. Reinstall the Missing Flatpak Runtimes
After removing the problematic files, reinstall them:
sudo flatpak update --appstream
The flatpak update command should install the missing runtimes automatically. If it doesn't reinstall the problematic runtime, simply reinstall it again. In my case, I reinstalled the following:
sudo flatpak install flathub org.freedesktop.Platform//23.08 org.kde.Platform//5.15-23.08
By this time, the problem will be sorted out. If not, follow the next steps.
4. Check Your Disk for Errors
If corruption happens frequently, your disk may have bad sectors. Run:
sudo dmesg | grep -i error sudo fsck -f /dev/sdX # Replace sdX with your root partition
5. Use a Different Flathub Mirror
If downloads remain corrupt, try switching to a different Flathub mirror:
flatpak remote-modify --url=https://mirror.flathub.org/repo flathub flatpak update
6. Check Network Connection
Corrupt downloads can occur due to unstable connections. If using WiFi, try switching to a wired connection, or use a VPN to check if the issue is region-specific.
7. Reinstall Flatpak (If Necessary)
As a last resort, you can reinstall Flatpak and re-add the Flathub repository:
sudo apt remove --purge flatpak sudo apt install flatpak flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak update
Conclusion
Following these steps should resolve Flatpak update errors caused by corrupted file objects. If problems persist, check your disk for errors or reinstall Flatpak entirely. Let us know in the comments if this guide helped you!
Related Read:
