# User card loading failed

**URL:** https://meta.discourse.org/t/user-card-loading-failed/366391
**Category:** Support
**Tags:** gamification, user-card
**Created:** [May 16, 2025, 7:53am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391 "2025-05-16T07:53:49Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![sheng\_hualuo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sheng_hualuo/32/430359_2.png) [@sheng\_hualuo](https://meta.discourse.org/u/sheng_hualuo)
#### Post date: [May 16, 2025, 7:53am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/1 "2025-05-16T07:53:49Z")

</div>

After the version update, I found that I couldn’t load the user card by clicking on the user’s avatar, and when I entered the personal information settings, it prompted that the page could not be found.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 7:58am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/3 "2025-05-16T07:58:26Z")

</div>

I updated yesterday and User Cards are loading fine for me.

Check [safe mode](https://meta.discourse.org/t/53504?silent=true). If that’s ok, then maybe you have an issue in one of your Themes or Theme Components?

Could you please provide any console errors.

---

<div class="post-metadata">

### Author: ![sheng\_hualuo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sheng_hualuo/32/430359_2.png) [@sheng\_hualuo](https://meta.discourse.org/u/sheng_hualuo)
#### Post date: [May 16, 2025, 8:06am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/4 "2025-05-16T08:06:11Z")

</div>

I’m in [safe mode](https://meta.discourse.org/t/53504?silent=true) and still can’t load, here’s my log information

```plaintext

Failed to handle exception in exception app middleware : ActiveRecord::StatementInvalid : PG::UndefinedTable: ERROR: relation "gamification_leaderboard_cache_1_all_time" does not exist LINE 1: ...p.t

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "gamification_leaderboard_cache_1_all_time" does not exist LINE 1: ...p.total_score, p.position FROM "users" INNER JOIN gamificati.

```

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 8:07am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/5 "2025-05-16T08:07:44Z")

</div>

That may have a bearing, but I was referring to _browser_ logs, can you share those?

ie the Browser console. (often opened by `F12`)

---

<div class="post-metadata">

### Author: ![sheng\_hualuo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sheng_hualuo/32/430359_2.png) [@sheng\_hualuo](https://meta.discourse.org/u/sheng_hualuo)
#### Post date: [May 16, 2025, 8:11am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/6 "2025-05-16T08:11:00Z")

</div>

```plaintext
topic-creator-avatar.hbr:1 [THEME 300 'Latest Theme Summary'] Compile error: unknown file extension 'hbr' (discourse/connectors/topic-list-before-columns/topic-creator-avatar.hbr)
(anonymous) @ topic-creator-avatar.hbr:1
[New] Use Copilot in Edge to explain console errors: Click
         
         to explain the error.
        Learn more
        Don't show again
composer-action-title.js:62 ℹ️ Discourse v3.5.0.beta5-dev — https://github.com/discourse/discourse/commits/7820dd2b8f — Ember v5.12.0
post-placeholder.js:53 [PLUGIN discourse-chain-topics] Deprecation notice: Defining connector classes via registerConnectorClass is deprecated. See https://meta.discourse.org/t/32727 for more modern patterns. [deprecation id: discourse.register-connector-class-legacy]
o @ post-placeholder.js:53
p @ topic-link.js:12
registerConnectorClass @ group.js:15
(anonymous) @ topic-custom-field-initializer.js:32
e1 @ group.js:15
initialize @ topic-custom-field-initializer.js:13
(anonymous) @ composer-action-title.js:62
(anonymous) @ item.js:166
e.each @ form-template-validation.js:54
e.walk @ form-template-validation.js:54
e.each @ form-template-validation.js:54
e.topsort @ form-template-validation.js:54
_runInitializer @ item.js:166
runInstanceInitializers @ item.js:166
_bootSync @ composer-action-title.js:62
didBecomeReady @ index.js:93
invoke @ client-error-handler.js:88
flush @ client-error-handler.js:88
flush @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_ensureInstance @ client-error-handler.js:88
schedule @ client-error-handler.js:88
f @ bookmark.js:114
waitForDOMReady @ index.js:93
init @ index.js:93
_ @ caret-position.js:86
create @ caret-position.js:86
(anonymous) @ start-app.js:4
(anonymous) @ discourse-boot.js:13
(anonymous) @ discourse-boot.js:1
post-placeholder.js:53 [PLUGIN discourse-chain-topics] Deprecation notice: Defining connector classes via registerConnectorClass is deprecated. See https://meta.discourse.org/t/32727 for more modern patterns. [deprecation id: discourse.register-connector-class-legacy]
o @ post-placeholder.js:53
p @ topic-link.js:12
registerConnectorClass @ group.js:15
(anonymous) @ topic-custom-field-initializer.js:83
e1 @ group.js:15
initialize @ topic-custom-field-initializer.js:13
(anonymous) @ composer-action-title.js:62
(anonymous) @ item.js:166
e.each @ form-template-validation.js:54
e.walk @ form-template-validation.js:54
e.each @ form-template-validation.js:54
e.topsort @ form-template-validation.js:54
_runInitializer @ item.js:166
runInstanceInitializers @ item.js:166
_bootSync @ composer-action-title.js:62
didBecomeReady @ index.js:93
invoke @ client-error-handler.js:88
flush @ client-error-handler.js:88
flush @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_ensureInstance @ client-error-handler.js:88
schedule @ client-error-handler.js:88
f @ bookmark.js:114
waitForDOMReady @ index.js:93
init @ index.js:93
_ @ caret-position.js:86
create @ caret-position.js:86
(anonymous) @ start-app.js:4
(anonymous) @ discourse-boot.js:13
(anonymous) @ discourse-boot.js:1
post-placeholder.js:53 [PLUGIN discourse-chain-topics] Deprecation notice: Defining connector classes via registerConnectorClass is deprecated. See https://meta.discourse.org/t/32727 for more modern patterns. [deprecation id: discourse.register-connector-class-legacy]
o @ post-placeholder.js:53
p @ topic-link.js:12
registerConnectorClass @ group.js:15
(anonymous) @ topic-custom-field-initializer.js:141
e1 @ group.js:15
initialize @ topic-custom-field-initializer.js:13
(anonymous) @ composer-action-title.js:62
(anonymous) @ item.js:166
e.each @ form-template-validation.js:54
e.walk @ form-template-validation.js:54
e.each @ form-template-validation.js:54
e.topsort @ form-template-validation.js:54
_runInitializer @ item.js:166
runInstanceInitializers @ item.js:166
_bootSync @ composer-action-title.js:62
didBecomeReady @ index.js:93
invoke @ client-error-handler.js:88
flush @ client-error-handler.js:88
flush @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_ensureInstance @ client-error-handler.js:88
schedule @ client-error-handler.js:88
f @ bookmark.js:114
waitForDOMReady @ index.js:93
init @ index.js:93
_ @ caret-position.js:86
create @ caret-position.js:86
(anonymous) @ start-app.js:4
(anonymous) @ discourse-boot.js:13
(anonymous) @ discourse-boot.js:1
discourse-home-page.js:79 discourse-home-page error: invalid path ""
s @ discourse-home-page.js:79
initialize @ discourse-home-page.js:42
(anonymous) @ composer-action-title.js:62
(anonymous) @ item.js:166
e.each @ form-template-validation.js:54
e.walk @ form-template-validation.js:54
e.each @ form-template-validation.js:54
e.topsort @ form-template-validation.js:54
_runInitializer @ item.js:166
runInstanceInitializers @ item.js:166
_bootSync @ composer-action-title.js:62
didBecomeReady @ index.js:93
invoke @ client-error-handler.js:88
flush @ client-error-handler.js:88
flush @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_ensureInstance @ client-error-handler.js:88
schedule @ client-error-handler.js:88
f @ bookmark.js:114
waitForDOMReady @ index.js:93
init @ index.js:93
_ @ caret-position.js:86
create @ caret-position.js:86
(anonymous) @ start-app.js:4
(anonymous) @ discourse-boot.js:13
(anonymous) @ discourse-boot.js:1
one-version.js:10 DEPRECATION: Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template:components/sidebar-theme-toggle'. [deprecation id: component-template-resolving] This will be removed in ember-source 6.0.0. See https://deprecations.emberjs.com/id/component-template-resolving for more details.
(anonymous) @ one-version.js:10
(anonymous) @ base.js:71
(anonymous) @ deprecate.js:100
(anonymous) @ base.js:71
(anonymous) @ deprecate.js:100
(anonymous) @ base.js:71
l @ index.js:49
(anonymous) @ render-tags.js:60
(anonymous) @ base.js:71
u @ index.js:49
(anonymous) @ base.js:71
(anonymous) @ base.js:71
(anonymous) @ base.js:71
(anonymous) @ bookmark.js:114
(anonymous) @ base.js:71
(anonymous) @ form-template-validation.js:54
(anonymous) @ base.js:71
s @ post-placeholder.js:53
(anonymous) @ base.js:71
r @ base.js:71
c @ deprecate.js:100
k @ upload.js:65
h @ binary.js:7
(anonymous) @ theme-setting.js:6
(anonymous) @ theme-setting.js:6
lookupComponent @ theme-setting.js:6
(anonymous) @ theme-setting.js:6
A @ theme-setting.js:6
o @ theme-setting.js:6
(anonymous) @ theme-setting.js:6
compile @ theme-setting.js:6
ef @ theme-setting.js:6
(anonymous) @ theme-setting.js:6
compile @ theme-setting.js:6
compile @ backup-codes.js:33
(anonymous) @ backup-codes.js:33
evaluate @ backup-codes.js:33
evaluateSyscall @ backup-codes.js:33
evaluateInner @ backup-codes.js:33
evaluateOuter @ backup-codes.js:33
next @ backup-codes.js:33
_execute @ backup-codes.js:33
execute @ backup-codes.js:33
sync @ backup-codes.js:33
(anonymous) @ theme-setting.js:6
(anonymous) @ theme-setting.js:6
tA @ backup-codes.js:33
_renderRoots @ theme-setting.js:6
_renderRootsTransaction @ theme-setting.js:6
_renderRoot @ theme-setting.js:6
_appendDefinition @ theme-setting.js:6
appendOutletView @ theme-setting.js:6
invoke @ client-error-handler.js:88
flush @ client-error-handler.js:88
flush @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_end @ client-error-handler.js:88
(anonymous) @ client-error-handler.js:88
Promise.then
(anonymous) @ client-error-handler.js:88
flush @ bookmark.js:114
_scheduleAutorun @ client-error-handler.js:88
_ensureInstance @ client-error-handler.js:88
schedule @ client-error-handler.js:88
f @ bookmark.js:114
waitForDOMReady @ index.js:93
init @ index.js:93
_ @ caret-position.js:86
create @ caret-position.js:86
(anonymous) @ start-app.js:4
(anonymous) @ discourse-boot.js:13
(anonymous) @ discourse-boot.js:1
includes.js?v=116e2a6fd81c286e004e2a0afb03baa1:840 
            
            
            GET https://www.tometo.me/u/shen_hualuo/card.json 500 (Internal Server Error)
(anonymous) @ includes.js?v=116e2a6fd81c286e004e2a0afb03baa1:840
send @ jquery.js:7408
ajax @ jquery.js:7408
a @ base.js:71
(anonymous) @ named-references.js:49
e @ named-references.js:49
A @ base.js:71
(anonymous) @ moment.js:257
(anonymous) @ group.js:15
(anonymous) @ named-references.js:49
e @ named-references.js:49
getAndRemove @ group.js:15
findDetails @ moment.js:257
findByUsername @ moment.js:257
_showCallback @ item.js:166
(anonymous) @ topic-link.js:12
invoke @ client-error-handler.js:88
flush @ client-error-handler.js:88
flush @ client-error-handler.js:88
_end @ client-error-handler.js:88
end @ client-error-handler.js:88
_runExpiredTimers @ client-error-handler.js:88
setTimeout
setTimeout @ client-error-handler.js:88
_installTimerTimeout @ client-error-handler.js:88
_reinstallTimerTimeout @ client-error-handler.js:88
_later @ client-error-handler.js:88
later @ client-error-handler.js:88
T @ bookmark.js:114
_show @ topic-link.js:12
_showCardOnClick @ topic-link.js:12
_cardClickHandler @ topic-link.js:12
_run @ client-error-handler.js:88
_join @ client-error-handler.js:88
join @ client-error-handler.js:88
p @ bookmark.js:114
(anonymous) @ bookmark.js:114

```

```plaintext
includes.js?v=116e2a…04e2a0afb03baa1:840 
 
 GET https://www.tometo.me/u/shen_hualuo.json 500 (Internal Server Error)
(anonymous)	@	includes.js?v=116e2a…04e2a0afb03baa1:840
send	@	jquery.js:7408
ajax	@	jquery.js:7408
a	@	base.js:71
(anonymous)	@	named-references.js:49
e	@	named-references.js:49
A	@	base.js:71
(anonymous)	@	moment.js:257
(anonymous)	@	group.js:15
(anonymous)	@	named-references.js:49
e	@	named-references.js:49
getAndRemove	@	group.js:15
findDetails	@	moment.js:257
afterModel	@	post-placeholder.js:53
runAfterModelHook	@	topic-link.js:12
(anonymous)	@	topic-link.js:12
k	@	named-references.js:49
w	@	named-references.js:49
invoke	@	client-error-handler.js:88
flush	@	client-error-handler.js:88
flush	@	client-error-handler.js:88
_end	@	client-error-handler.js:88
(anonymous)	@	client-error-handler.js:88
Promise.then		
(anonymous)	@	client-error-handler.js:88
flush	@	bookmark.js:114
_scheduleAutorun	@	client-error-handler.js:88
_ensureInstance	@	client-error-handler.js:88
schedule	@	client-error-handler.js:88
(anonymous)	@	hashtag-autocomplete.js:158
T	@	named-references.js:49
resolve	@	topic-link.js:12
T	@	form-template-validation.js:54
getTransitionByIntent	@	topic-link.js:12
transitionByIntent	@	topic-link.js:12
doTransition	@	topic-link.js:12
transitionTo	@	topic-link.js:12
_doTransition	@	upload.js:65
transitionTo	@	binary.js:7
(anonymous)	@	theme-setting.js:6
l	@	UIPlugin.js:138
click

```

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 8:36am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/7 "2025-05-16T08:36:07Z")

</div>

So I don’t believe you were in [safe mode](https://meta.discourse.org/t/53504?silent=true).

This component seems to be causing an issue:

```plaintext
topic-creator-avatar.hbr:1 [THEME 300 '最新主题摘要'] Compile error: unknown file extension 'hbr' (discourse/connectors/topic-list-before-columns/topic-creator-avatar.hbr)
(匿名) @ topic-creator-avatar.hbr:1

```

That’s because hbr (raw) templates are no longer supported.

Raise with the author of that Theme.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [May 16, 2025, 8:36am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/8 "2025-05-16T08:36:22Z")

</div>

> [@sheng\_hualuo](#):
>
> ```plaintext
> board_cache_1_all_time" does not exist LINE 1: ...p.t
> 
> ```

@manuel didn’t you encounter this one as well?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 8:40am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/9 "2025-05-16T08:40:47Z")

</div>

> [@sheng\_hualuo](#):
>
> ```plaintext
> Failed to handle exception in exception app middleware : ActiveRecord::StatementInvalid : PG::UndefinedTable: ERROR: relation "gamification_leaderboard_cache_1_all_time" does not exist LINE 1: ...p.t
> 
> ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "gamification_leaderboard_cache_1_all_time" does not exist LINE 1: ...p.total_score, p.position FROM "users" INNER JOIN gamificati.
> 
> ```

> [@sheng\_hualuo](#):
>
> `GET https://www.tometo.me/u/shen_hualuo.json 500 (Internal Server Error)`

So these look related.

Looks like Gamification is modifying the User data and is throwing an error.

So that almost certainly explains why the User Card is not loading.

It looks to me like you have more than one issue and are related to addins, not Core Discourse.

I would remove:

- Gamification plugin
- Whatever theme component ([THEME 300 ‘最新主题摘要’]) is causing that other browser error (needs to be rewritten to avoid use of .hbr templates)

until you can solve those issues.

Suggest reporting the Gamification error on the [Gamification Topic](https://meta.discourse.org/t/discourse-gamification/225916).

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 16, 2025, 8:52am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/10 "2025-05-16T08:52:28Z")

</div>

> [@merefield](#):
>
> Suggest reporting the Gamification error on the [Gamification Topic](https://meta.discourse.org/t/discourse-gamification/225916).

As it’s an #official plugin you can also report a bug in the #Contribute > Bug category (though remember to add the #gamification tag). 🥳

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 8:56am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/11 "2025-05-16T08:56:47Z")

</div>

That’s true.

In any case this Topic is now dealing with two issues, and they should probably be broken out into two.

The user card not loading is most likely a Gamification issue though, so perhaps use this one for that. #gamification tag added.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 8:59am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/12 "2025-05-16T08:59:45Z")

</div>

(ok so THAT’S confusing the Topic meta editing interface has changed!)

---

<div class="post-metadata">

### Author: ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)
#### Post date: [May 16, 2025, 9:01am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/13 "2025-05-16T09:01:31Z")

</div>

> [@RGJ](#):
>
> @manuel didn’t you encounter this one as well?

Yes.

![Screenshot From 2025-05-13 11-54-39](https://global.discourse-cdn.com/meta/optimized/4X/e/b/b/ebba3463e270afdee9d50a9f16e3ea415dd571b1_2_690x26.png)

That was when I tried installing a backup. Accessing user-cards and user-pages failed until I deleted the leaderboard from the backup.

edit: on a different note, it seems my screenshot doesn’t open in a lightbox? The upload was 1693px wide, but it only shows in 690.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 9:06am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/14 "2025-05-16T09:06:54Z")

</div>

That seems very Draconian. I wonder if there is a lighter weight solution?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 9:11am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/15 "2025-05-16T09:11:50Z")

</div>

This looks potentially related:

> <https://github.com/discourse/discourse-gamification/blob/main/db/post_migrate/20250210133038_drop_versioned_leaderboard_materialized_views.rb>

[https://github.com/discourse/discourse-gamification/commit/19a4cc7c0bdc60f2b3c1eb747e80fd6211005874](https://github.com/discourse/discourse-gamification/commit/19a4cc7c0bdc60f2b3c1eb747e80fd6211005874)

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [May 16, 2025, 10:17am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/16 "2025-05-16T10:17:37Z")

</div>

> [@manuel](#):
>
> on a different note, it seems my screenshot doesn’t open in a lightbox?

Yes, weird, original [here](https://global.discourse-cdn.com/meta/original/4X/e/b/b/ebba3463e270afdee9d50a9f16e3ea415dd571b1.png) for people who want to actually be able to read it 🙂

> [@merefield](#):
>
> This looks potentially related

It might be. This migration deletes _versioned_ cache views that have `_x` tacked to the end (where x is a digit). But the table that it misses is an unversioned table (without `_x`).

@sheng_hualuo can you try running this from a rails console?

`DiscourseGamification::LeaderboardCachedView.regenerate_all`

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 10:20am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/17 "2025-05-16T10:20:32Z")

</div>

> [@RGJ](#):
>
> But the table that it misses is an unversioned table (without `_x`).

`gamification_leaderboard_cache_1_all_time` isn’t 1 the version?

I think for some reason the naming convention was changed.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [May 16, 2025, 10:22am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/18 "2025-05-16T10:22:31Z")

</div>

No, that’s the leaderbord id. It’s all explained in the commit message of the commit you mentioned.

Also, look at the regex `'gamification_leaderboard_cache_[0-9]+_[a-zA-Z_]+_[1-9]$'`

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 16, 2025, 10:23am UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/19 "2025-05-16T10:23:36Z")

</div>

Ah, that all starts to make sense. So the versioned version (ahem) was dropped, but for some reason the new version (ahem) has not been materialised.

---

<div class="post-metadata">

### Author: ![selase](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/selase/32/270909_2.png) [@selase](https://meta.discourse.org/u/selase)
#### Post date: [May 19, 2025, 2:44pm UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/21 "2025-05-19T14:44:45Z")

</div>

I don’t have the full trace, but I believe the error happens during `gamification_score` serialization for the user card.

Given the transient nature of these materialized views, a score lookup isn’t expected to cause a system-wide error, it should fall back to a “default score” when the view doesn’t exist.

There’s a bug in the materialized view [existence check](https://github.com/discourse/discourse-gamification/blob/213af96acc1ff24ba61b93dff1dcea2791154511/lib/discourse_gamification/leaderboard_cached_view.rb#L226-L232). It reports that a view exists when it actually doesn’t (at least not in the current `public` schema), which leads to a lookup on a non-existent view resulting in the error.

I think what happened here was, the materialized view was present in the `backup` schema created as part of the restore but not the `public` schema. The `backup` schema is retained for a while after the restore.

> <https://github.com/discourse/discourse-gamification/blob/213af96acc1ff24ba61b93dff1dcea2791154511/plugin.rb#L100>

> <https://github.com/discourse/discourse-gamification/blob/213af96acc1ff24ba61b93dff1dcea2791154511/lib/discourse_gamification/user_extension.rb#L15>

> <https://github.com/discourse/discourse-gamification/blob/213af96acc1ff24ba61b93dff1dcea2791154511/lib/discourse_gamification/leaderboard_cached_view.rb#L51-L68>

I’ve got a PR ready with a fix.

[https://github.com/discourse/discourse-gamification/pull/203](https://github.com/discourse/discourse-gamification/pull/203)

---

<div class="post-metadata">

### Author: ![selase](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/selase/32/270909_2.png) [@selase](https://meta.discourse.org/u/selase)
#### Post date: [May 22, 2025, 2:40pm UTC](https://meta.discourse.org/t/user-card-loading-failed/366391/23 "2025-05-22T14:40:51Z")

</div>


