Avatar selector modal crashes with "t.split is not a function" (avatar-selector.gjs)

Summary:
Opening the avatar selector modal (to change profile avatar) throws a JavaScript error and the popup fails to work correctly.

Discourse version: v2026.7.0-latest (commit 59588b5d2a)
Ember version: v6.10.1

Steps to reproduce:

  1. Go to user profile
  2. Click on the option to change avatar
  3. The avatar selector modal opens (triggered via a “solved” move confirmation modal flow, based on the stack trace)
  4. Error appears immediately in the browser console and the modal does not behave correctly

Expected behavior:
The avatar selector should open normally and let the user pick/upload an avatar.

Actual behavior:
Console throws: TypeError: t.split is not a function inside selectableAvatars getter in avatar-selector.gjs.

Troubleshooting already done:

  • Tested in Safe Mode with all themes and plugins disabled the error still occurs, so this does not appear to be caused by a theme or plugin.

**Browser / OS:** Brave Windows 11

**Console log / stack trace:**

?safe_mode=no_themes,no_plugins:346  GET https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496 net::ERR_BLOCKED_BY_CLIENT
app.js:365 ℹ️ Discourse v2026.7.0-latest — https://github.com/discourse/discourse/commits/59588b5d2a — Ember v6.10.1
avatar-selector.gjs:47 Uncaught (in promise) TypeError: t.split is not a function
at get selectableAvatars (avatar-selector.gjs:47:47)
at R (cache-DtDz7X5V.js:1647:15)
at index.js:87:32
at index.js:64:37
at zn (index.js:396:5)
at j (index.js:62:16)
at index-DaCZcoCY.js:4335:20
at index.js:64:37
at zn (index.js:396:5)
at j (index.js:62:16)
at index-DaCZcoCY.js:4335:20
at index.js:64:37
at zn (index.js:396:5)
at j (index.js:62:16)
at index.js:158:20
at index.js:64:37
at zn (index.js:396:5)
at j (index.js:62:16)
at Object.evaluate (index.js:1970:16)
at Object.evaluate (index.js:103:106)
at zb.evaluateSyscall (index.js:2873:20)
at zb.evaluateInner (index.js:2852:64)
at zb.evaluateOuter (index.js:2849:10)
at e.next (index.js:4167:45)
at e._execute (index.js:4157:21)
at e.execute (index.js:4133:41)
at _x.handleException (index.js:3450:19)
at bx.handleException (index.js:3592:52)
at hx.throw (index.js:3414:16)
at iy.evaluate (index.js:565:37)
at hx._execute (index.js:3401:34)
at hx.execute (index.js:3393:17)
at xx.rerender (index.js:3610:8)
at ww.render (index-DaCZcoCY.js:5211:23)
at index-DaCZcoCY.js:5409:16
at xb (index.js:2414:7)
at e.renderRoots (index-DaCZcoCY.js:5389:7)
at #o (index-DaCZcoCY.js:5374:12)
at e.revalidate (index-DaCZcoCY.js:5435:10)
at invoke (index.js:264:14)
at Rc.flush (index.js:180:11)
at zc.flush (index.js:334:19)
at pl._end (index.js:762:32)
at _boundAutorunEnd (index.js:499:12)
selectableAvatars @ avatar-selector.gjs:47
_getProp @ cache-DtDz7X5V.js:1647
(anonymous) @ index.js:87
(anonymous) @ index.js:64
track @ index.js:396
valueForRef @ index.js:62
(anonymous) @ index-DaCZcoCY.js:4335
(anonymous) @ index.js:64
track @ index.js:396
valueForRef @ index.js:62
(anonymous) @ index-DaCZcoCY.js:4335
(anonymous) @ index.js:64
track @ index.js:396
valueForRef @ index.js:62
(anonymous) @ index.js:158
(anonymous) @ index.js:64
track @ index.js:396
valueForRef @ index.js:62
(anonymous) @ index.js:1970
evaluate @ index.js:103
evaluateSyscall @ index.js:2873
evaluateInner @ index.js:2852
evaluateOuter @ index.js:2849
next @ index.js:4167
_execute @ index.js:4157
execute @ index.js:4133
handleException @ index.js:3450
handleException @ index.js:3592
throw @ index.js:3414
evaluate @ index.js:565
_execute @ index.js:3401
execute @ index.js:3393
rerender @ index.js:3610
(anonymous) @ index-DaCZcoCY.js:5211
(anonymous) @ index-DaCZcoCY.js:5409
inTransaction @ index.js:2414
renderRoots @ index-DaCZcoCY.js:5389
#o @ index-DaCZcoCY.js:5374
revalidate @ index-DaCZcoCY.js:5435
invoke @ index.js:264
flush @ index.js:180
flush @ index.js:334
_end @ index.js:762
(anonymous) @ index.js:499
Promise.then
(anonymous) @ index.js:18
flush @ index.js:29
_scheduleAutorun @ index.js:928
_end @ index.js:768
(anonymous) @ index.js:499
Promise.then
(anonymous) @ index.js:18
flush @ index.js:29
_scheduleAutorun @ index.js:928
_end @ index.js:768
(anonymous) @ index.js:499
Promise.then
(anonymous) @ index.js:18
flush @ index.js:29
_scheduleAutorun @ index.js:928
_ensureInstance @ index.js:919
ensureInstance @ index.js:731
scheduleRevalidate @ index-DaCZcoCY.js:4146
dirtyTag @ index.js:229
dirtyTagFor @ index.js:848
setter @ index.js:871
set @ cache-DtDz7X5V.js:1886
show @ modal.js:57
await in show
showAvatarSelector @ account.js:43
_join @ index.js:788
join @ index.js:605
join @ index.js:152
(anonymous) @ route-action.js:48
(anonymous) @ index.js:2534
(anonymous) @ d-button.gts:216
invoke @ index.js:264
flush @ index.js:180
flush @ index.js:334
_end @ index.js:762
end @ index.js:565
_runExpiredTimers @ index.js:869
setTimeout
setTimeout @ index.js:39
_installTimerTimeout @ index.js:912
_reinstallTimerTimeout @ index.js:896
_later @ index.js:829
later @ index.js:652
next @ index.js:562
_triggerAction @ d-button.gts:213
click @ d-button.gts:167
2 Likes

Can you reproduce this issue here on meta?

Is the error message above from your instance and are you behind Cloudflare? This part of it would seem to indicate so.

1 Like

Hi,

Thanks for the reply and for pointing that out.

To answer your question: no, I can’t reproduce this on meta.discourse.org itself only on my own forum.

Regarding Cloudflare: yes, my forum is behind Cloudflare, but that specific console line (the beacon.min.js / ERR_BLOCKED_BY_CLIENT one) is unrelated to the actual bug. It’s caused by Brave Shields blocking Cloudflare’s analytics script. I disabled Brave Shields entirely and that line disappears, but the avatar selector error (TypeError: t.split is not a function) still occurs exactly the same way.

For context: I’ve been running my forum behind Cloudflare for almost 3 years, and changing the profile avatar has always worked fine until now. So this seems to be a regression rather than a long-standing Cloudflare-related issue.

Since it doesn’t reproduce on meta, this might be specific to something in my setup. Happy to dig into any settings or logs that would help narrow it down. Let me know what would be useful to check (e.g. the “selectable avatars” site setting value, or anything related to the Solved plugin, which I noticed appears in the stack trace as the trigger for this modal).

Thanks for looking into this.

2 Likes

yeah, you’re right, it’s likely not Cloudflare.

I tested this on a separate instance, where I enabled only selectable avatars. I had to upload two avatars (site setting requirement) and then enable.

Can you modify these two settings and see if it changes anything on your end?

2 Likes

Hi,

Thanks for digging into this. You were right.

I uploaded two avatars to the “selectable avatars” setting as you suggested, and the error is gone. Avatar selector now opens and works correctly.

So it looks like the root cause is: when “selectable avatars” is enabled but has fewer than the required number of avatars uploaded (or is empty), the modal crashes instead of failing gracefully. In my case the setting was enabled with no avatars uploaded, which triggered the t.split is not a function error.

I still think this is worth fixing on the core side. Even if the setting is misconfigured, the modal shouldn’t throw an uncaught TypeError and break avatar selection entirely. Ideally it would either:

  • fall back to normal avatar selection (skip the “selectable avatars” feature) if the list is empty/invalid, or
  • show a clear validation error instead of a silent JS crash

Thanks again for the help narrowing this down!

2 Likes

Yeah, that’s fair. Do you want to submit a fix? If you’re familiar, I’m happy to accept a Pull Request for this.

1 Like

I am into software development, but I don’t have much experience with this kind of thing. so I’m a bit hesitant to submit a fix myself and risk getting it wrong. If someone from the core team wants to take it from here, that would be great. But I can open an issue on github if you want.

3 Likes

No problem, this should do it: DEV: Fix JS error in modal when selected avatars is misconfigured - Pull Request #41663 - discourse/discourse - GitHub

1 Like