Bug 2330306

Summary: "dnf install" errors if there is empty /var/cache/libdnf5/temporary_files.toml file: toml::value::as_array(): bad_cast to array
Product: [Fedora] Fedora Reporter: Herbert Carl Meyer <hcmeyer>
Component: dnf5Assignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 42CC: jkolarik, lucacorbioli12345, mblaha, nsella, pkratoch, pokorny_jan, ppisar, rpm-software-management
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: dnf5-5.2.16.0-1.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-08-16 01:05:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Herbert Carl Meyer 2024-12-04 10:35:51 UTC
any attempt to use dnf results in error:

An error occurred when parsing the temporary files memory file at '/var/cache/libdnf5/temporary_files.toml': [error] toml::value::as_array(): bad_cast to array
 --> unknown file

Google pointed me at python3-toml, but that package is not installed. Dnf is broken, so I cannot install anything to fix it. GnomeSoftware still works, I can do system updates, but nothing selective.

Reproducible: Always

Steps to Reproduce:
1. try to install software with dnf
2.
3.
Actual Results:  
ailed to download packages
 An error occurred when parsing the temporary files memory file at '/var/cache/libdnf5/temporary_files.toml': [error] toml::value::as_array(): bad_cast to array
 --> unknown file




fresh install of rawhide

Comment 1 Petr Pisar 2024-12-04 14:06:04 UTC
Could you tell us what dnf5 version you use and what was the last operation with it before it started reporting this error?

Comment 2 Petr Pisar 2024-12-04 14:21:14 UTC
By the way, what is a content of your /var/cache/libdnf5/temporary_files.toml?

Comment 3 Herbert Carl Meyer 2024-12-05 03:39:52 UTC
/var/cache/libdnf5/temporary_files.toml is empty, zero length. The curious thing about it is the date, Dec. 1, rather than today, Dec. 4. It is not being newly created ? An earlier failure left this artifact ?

Comment 4 Petr Pisar 2024-12-05 08:02:34 UTC
It might happened that DNF5 crashed before writing to that file. Currently DNF5 reports an error instead of ignoring bogus TOML files. If you want to get the error away, you can remove that file. A purpose of that file is to enumerate downloaded, but not yet installed packages. I think we won't find out how the bogus file was produced.

I can reproduce the error by creating that empty file end invoking "dnf reinstall bash" with dnf5-5.2.8.0-20241204010939.0.g2af228e4.fc42.x86_64.

Comment 5 Herbert Carl Meyer 2024-12-05 09:46:57 UTC
I will remove file and retry.

Comment 6 Herbert Carl Meyer 2024-12-05 10:22:08 UTC
Removing file removed error. Thank you.

further search turned up:

https://github.com/rpm-software-management/dnf5/issues/1001

Known isssue.

Comment 7 Petr Pisar 2025-02-13 13:19:05 UTC
*** Bug 2345199 has been marked as a duplicate of this bug. ***

Comment 8 Aoife Moloney 2025-02-26 13:19:19 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 9 Petr Pisar 2025-06-02 15:04:25 UTC
*** Bug 2369519 has been marked as a duplicate of this bug. ***

Comment 10 Marek Blaha 2025-08-01 06:35:47 UTC
Upstream PR: https://github.com/rpm-software-management/dnf5/pull/2372

Comment 11 Fedora Update System 2025-08-14 16:21:44 UTC
FEDORA-2025-e4842f3165 (dnf5-5.2.16.0-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-e4842f3165

Comment 12 Fedora Update System 2025-08-16 01:05:41 UTC
FEDORA-2025-e4842f3165 (dnf5-5.2.16.0-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.