Bug 515150 - Discover crashes when I try to apply updates - FlatpakBackend::getAppForInstalledRef(...) at FlatpakBackend.cpp:536
Summary: Discover crashes when I try to apply updates - FlatpakBackend::getAppForInsta...
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: Updates (other bugs)
Version First Reported In: 6.5.5
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 516366 (view as bug list)
Depends on:
Blocks:
 
Reported: 2026-01-27 11:23 UTC by BOF
Modified: 2026-03-04 10:59 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.6.1
Sentry Crash Report:


Attachments
gdb backtrace (91.27 KB, text/plain)
2026-01-28 22:00 UTC, BOF
Details

Note You need to log in before you can comment on or make changes to this bug.
Description BOF 2026-01-27 11:23:30 UTC
SUMMARY
When I open Discover and try to apply updates Discover crashes every time.

STEPS TO REPRODUCE
1. Open Discover when connected to the internet
2. Just wait until it searched for updates

OBSERVED RESULT
Discover crashes every time

EXPECTED RESULT
No crash

SOFTWARE/OS VERSIONS

Discover version: 6.5.5

Operating System: KDE neon User Edition
KDE Plasma Version: 6.5.5
KDE Frameworks Version: 6.22.0
Qt Version: 6.10.1
Kernel Version: 6.14.0-37-generic (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
1) If you are not connected to the internet Discover does not crash. When not connected it showed me that there are some system packages ready to be updated, but when reconnected to the internet and on research for updates Discover crashes again.
It seems to crash when it's at the step for searching for updates to flatpacks. So this might be related to Bug 512960.

2) I'm trying to get a backtrace right now, but this might take some time.
If you have a link to a step by step guide it could be easier for me.
Comment 1 BOF 2026-01-27 11:29:50 UTC
Opened from terminal:

plasma-discover 
libs QList("/usr/lib/x86_64-linux-gnu/qt6/plugins", "/usr/bin")
org.kde.plasma.libdiscover: OdrsReviewsBackend: Fetch ratings: false
org.kde.plasma.libdiscover: OdrsReviewsBackend: Error parsing ratings: "Unbekannter Fehler" "Ungültiger Wert"
adding empty sources model QStandardItemModel(0x5962204ce790)
looking up wrong category or too early "Games"
looking up wrong category or too early "Development"
ASSERT failure in getAppForInstalledRef: "app/com.github.marinm.songrec/x86_64/stable", file /workspace/build/libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp, line 536
KCrash: Application 'plasma-discover' crashing... crashRecursionCounter = 2
Aborted (core dumped)
Comment 2 BOF 2026-01-28 22:00:20 UTC
Created attachment 189004 [details]
gdb backtrace

Full backtrace of the crash.


) uname -r
6.14.0-37-generic

) lsb_release -a
No LSB modules are available.
Distributor ID: Neon
Description:    KDE neon User Edition
Release:        24.04
Codename:       noble

) plasma-discover --version
discover 6.5.5

) gdb --version
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git


According to ChatGPT Discover was ended intentionally because of a "Q_ASSERT" in the FlatpakBackend. The trigger is an installed Flatpak-Ref, for that Discover can not make a FlatpakResource.
Comment 3 BOF 2026-01-28 22:11:47 UTC
Further ChatGPT comments:

The crash lies here:
#10 FlatpakBackend::getAppForInstalledRef(...)
    at FlatpakBackend.cpp:536

and before that:
ASSERT failure in getAppForInstalledRef:
"app/com.github.marinm.songrec/x86_64/stable"
file FlatpakBackend.cpp, line 536

qt is doing:
qFatal → qAbort → abort() → SIGABRT

getAppForInstalledRef() seems to expect an app-object (?) for every installed FlatpakRef that Discover knows or can create (/build?)

The stack is:
FlatpakBackend::listInstalledRefsForUpdate()
 → search()
 → getAppForInstalledRef()

o) flatpak info com.github.marinm.songrec

SongRec - An open-source, unofficial Shazam client for Linux, written in Rust.

         Kennung: com.github.marinm.songrec
             Ref: app/com.github.marinm.songrec/x86_64/stable
     Architektur: x86_64
           Zweig: stable
         Version: 0.4.3
          Lizenz: GPL-3.0+
        Ursprung: flathub
        Sammlung: org.flathub.Stable
    Installation: system
     Installiert: 8,5 MB
Laufzeitumgebung: org.freedesktop.Platform/x86_64/25.08
             Sdk: org.freedesktop.Sdk/x86_64/25.08

          Commit: b29611a572c18df4b127ab527367f45ab7c314476fdd10a917a76cf893ebde95
          Parent: 9f91fad606bd191d6370b40d72b7c3a014caf9c907af6ffb783226a79f6f4826
         Betreff: Merge pull request #9 from Fei1Yang/update-runtime (1e076ac865bc)
           Datum: 2025-10-12 18:17:19 +0000

o) flatpak info --show-ref com.github.marinm.songrec
app/com.github.marinm.songrec/x86_64/stable
Comment 4 BOF 2026-01-28 22:17:33 UTC
From a UX point of view, this looks like a deadlock as I can not update the system or discover by opening it (I can probably update the system via the command line, but this should not be expected from a new Linux user who may even just left Windows)

I still wonder how a new user would actually do that. Because Discover crashes during startup, users have no way to recover from broken Flatpak metadata using the GUI. A safe-mode or backend-disable mechanism is missing.

Something like 
o) plasma-discover --safe-mode
that disables flatpaks, online repos and only allows local PackageKit data

or a question on crash:

„Discover crashed while loading Flatpak backend.
Start without Flatpak support? [Yes] [No]“

would be interesting to have.
Comment 5 Bug Janitor Service 2026-01-31 13:29:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/1253
Comment 6 Harald Sitter 2026-02-16 11:30:10 UTC
Git commit 4449cfe3dce1627bad14011d4d7783e7f4f1bde2 by Harald Sitter.
Committed on 16/02/2026 at 11:23.
Pushed by sitter into branch 'master'.

flatpak: consider provided appstream ids when asserting resolution results

when an appstream id changes we may have 'foo' installed but get a
component with the new name 'bar'. this would previously fail the
assertion. now we take the provided ids also into account so that the
assertion passes as long as any provided id matches

M  +21   -3    libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp

https://invent.kde.org/plasma/discover/-/commit/4449cfe3dce1627bad14011d4d7783e7f4f1bde2
Comment 7 Nate Graham 2026-02-19 03:06:51 UTC
Git commit 3fc81c2331773aac539a6e67d5dc3f3d2c6158e8 by Nate Graham.
Committed on 19/02/2026 at 02:21.
Pushed by ngraham into branch 'Plasma/6.6'.

flatpak: consider provided appstream ids when asserting resolution results

when an appstream id changes we may have 'foo' installed but get a
component with the new name 'bar'. this would previously fail the
assertion. now we take the provided ids also into account so that the
assertion passes as long as any provided id matches


(cherry picked from commit 4449cfe3dce1627bad14011d4d7783e7f4f1bde2)

Co-authored-by: Harald Sitter <sitter@kde.org>

M  +21   -3    libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp

https://invent.kde.org/plasma/discover/-/commit/3fc81c2331773aac539a6e67d5dc3f3d2c6158e8
Comment 8 Nate Graham 2026-03-03 16:46:39 UTC
*** Bug 516366 has been marked as a duplicate of this bug. ***
Comment 9 BOF 2026-03-04 10:59:49 UTC
A succeeding bug might be https://bugs.kde.org/show_bug.cgi?id=517077

My guess reasoning from the process described in the linked ticker: Discover asks you if you want to change the package (source/id/?). If you agree, the package seems to be removed, but the new one not installed. Instead Discover crashed.