Full Disclosure: I used ask.discourse to compose this bug report after a conversation. Also, I know I’m behind on updates but I wanted to post this while it was still fresh in my mind.
I was able to reproduce this on two different user accounts.
Summary
Requesting a user data archive (Preferences → Export your data → Request archive) fails for users who have bookmarked a Data Explorer group report. The Jobs::ExportUserArchive background job crashes while generating the Bookmarks CSV, so the export never completes and no download link is sent.
Environment
- Discourse version: 2026.8.0-latest.1
- Data Explorer: bundled with core (version follows core)
- Self-hosted / hosted: self-hosted
- Ruby/Rails stack per backtrace: activemodel/activerecord 8.0.5.1, Sidekiq 7.3.10
Steps to reproduce
- As an admin, create a Data Explorer query and grant access to a group.
- On the group’s Reports tab, click Bookmark on the query so it becomes a bookmarked group report.
- As that same user, go to Preferences → Export your data → Request archive.
- Watch the job fail (check
Admin → Logsor Sidekiq logs).
Expected behavior
The user archive should be generated and the user should receive the download link, including their bookmarks.
Actual behavior
The export job raises an exception and the archive fails. The backtrace shows the crash occurring in bookmarks_export, where the job calls .url on the bookmarked object:
Job exception: undefined method 'url' for an instance of DiscourseDataExplorer::QueryGroup
Backtrace (abridged to the relevant frames):
activemodel-8.0.5.1/lib/active_model/attribute_methods.rb:512:in 'ActiveModel::AttributeMethods#method_missing'
activerecord-8.0.5.1/lib/active_record/attribute_methods.rb:495:in 'ActiveRecord::AttributeMethods#method_missing'
/var/www/discourse/app/jobs/regular/export_user_archive.rb:325:in 'block in Jobs::ExportUserArchive#bookmarks_export'
activerecord-8.0.5.1/lib/active_record/relation/delegation.rb:101:in 'Array#each'
activerecord-8.0.5.1/lib/active_record/relation/delegation.rb:101:in 'ActiveRecord::Delegation#each'
/var/www/discourse/app/jobs/regular/export_user_archive.rb:319:in 'Jobs::ExportUserArchive#bookmarks_export'
/var/www/discourse/app/jobs/regular/export_user_archive.rb:170:in 'Kernel#public_send'
/var/www/discourse/app/jobs/regular/export_user_archive.rb:170:in 'block (2 levels) in Jobs::ExportUserArchive#execute'
/var/www/discourse/app/jobs/regular/export_user_archive.rb:168:in 'block in Jobs::ExportUserArchive#execute'
Analysis
Bookmarks are polymorphic. The export job calls bookmarkable.url, which works for core bookmarkable types (Topic, Post), but DiscourseDataExplorer::QueryGroup does not implement url, so the job raises NoMethodError on the first such bookmark.
It appears Data Explorer registers query groups as bookmarkable (via the group report Bookmark button), but the model lacks the url method (or the core export job needs a guard for bookmarkable types that don’t provide one).
Suggested fix
Either implement a url method on DiscourseDataExplorer::QueryGroup, or make core’s bookmarks_export defensive (e.g., bookmarkable.respond_to?(:url) / rescue per-row) so a single unsupported bookmarkable type can’t kill the whole export.
Workaround
Deleting the offending bookmarks (rows in bookmarks where bookmarkable_type = 'DiscourseDataExplorer::QueryGroup' for the affected user) allows the export to complete.