# User data archive export fails: undefined method 'url' for an instance of DiscourseDataExplorer::QueryGroup

**URL:** <https://meta.discourse.org/t/user-data-archive-export-fails-undefined-method-url-for-an-instance-of-discoursedataexplorer-querygroup/415001>\
**Category:** Bug\
**Tags:** data-explorer, bookmarks\
**Created:** [October 19, 2026, 5:37am UTC](https://meta.discourse.org/t/user-data-archive-export-fails-undefined-method-url-for-an-instance-of-discoursedataexplorer-querygroup/415001 "2026-10-19T05:37:45Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![one1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/one1/32/493591_2.png) [@one1](https://meta.discourse.org/u/one1)\
**Post date:** [October 19, 2026, 5:37am UTC](https://meta.discourse.org/t/user-data-archive-export-fails-undefined-method-url-for-an-instance-of-discoursedataexplorer-querygroup/415001/1 "2026-10-19T05:37:45Z")

</div>

**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](https://meta.discourse.org/t/32566?silent=true) 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](https://meta.discourse.org/t/32566?silent=true): 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

1. As an admin, create a [Data Explorer](https://meta.discourse.org/t/32566?silent=true) query and grant access to a group.
2. On the group’s **Reports** tab, click **Bookmark** on the query so it becomes a bookmarked group report.
3. As that same user, go to **Preferences → Export your data → Request archive**.
4. Watch the job fail (check `Admin → Logs` or 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:

```plaintext
Job exception: undefined method 'url' for an instance of DiscourseDataExplorer::QueryGroup

```

Backtrace (abridged to the relevant frames):

```plaintext
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](https://meta.discourse.org/t/32566?silent=true) 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.

---

_[View the full topic](https://meta.discourse.org/t/user-data-archive-export-fails-undefined-method-url-for-an-instance-of-discoursedataexplorer-querygroup/415001)._
