# Reset the user-selectable avatar Ops-error 500

**URL:** https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032
**Category:** Bug
**Created:** [March 26, 2022, 9:25am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032 "2022-03-26T09:25:50Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![daming](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daming/32/246799_2.png) [@daming](https://meta.discourse.org/u/daming)
#### Post date: [March 26, 2022, 9:25am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/1 "2022-03-26T09:25:50Z")

</div>

When I add a user-selectable avatar, and then reset the user-selectable avatar, it suddenly shows an Ops-error 500, and then I can’t do anything.

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/2/42280f7983e247f6d8ab40f369d20ddac4fddd22.jpeg)

Add:This happened once before, but it disappeared after ten minutes. v2.9.3 beta

After half an hour it was working fine

But magically after half an hour I didn’t do anything and it didn’t work again,Show the same error page.

---

<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: [March 26, 2022, 10:13am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/2 "2022-03-26T10:13:40Z")

</div>

I can replicate this ([136f7dbf78](https://github.com/discourse/discourse/commits/136f7dbf78c19bd6af0fbd049eb233028312335b))

- Added a couple of `selectable avatars`
- Enabled `selectable avatars mode` for `everyone`  
  
- Reset `selectable avatars`, though the green tick was unpressable
- Reset `selectable avatars mode`
- Got ‘Ooops. The software powering this discussion…’

I can’t get rid of the Ooops screen. 🤔 My test site is now down and out, across both test user and admin, on Chrome and Firefox.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 26, 2022, 10:29am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/3 "2022-03-26T10:29:23Z")

</div>

Check the logs in `/var/discourse/shared/standalone/logs/rails/production.log` and see what the error is and report that.

And then you can go into rails and un-do the changes you made. I think with something like

```
    Sitesettings.selectable_avatar_whatever=false

```

You can use tab completion after you type selectable or maybe start with avatar? I don’t know how that stuff works off the top of my head.

---

<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: [March 26, 2022, 10:49am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/4 "2022-03-26T10:49:17Z")

</div>

I have jumped on my laptop to have a look at the logs. I’m still fairly new at this, so correct me if I’ve pulled out the wrong thing. 🙂

```plaintext
Started PUT "/admin/site_settings/selectable_avatars" for 176.25.113.180 at 2022-03-26 10:09:12 +0000
Processing by Admin::SiteSettingsController#update as */*
  Parameters: {"selectable_avatars"=>"", "id"=>"selectable_avatars"}
Completed 500 Internal Server Error in 62ms (ActiveRecord: 0.0ms | Allocations: 3529)
NoMethodError (undefined method `to_i' for []:Array
Did you mean? to_s
               to_a
               to_h)

```

I think that is the original error, though there are more from my attempts to access different pages after. Is that the right thing?

Taking a closer look, it appears the errors are the same, just triggered by different pages:

```plaintext
Started GET "/login" for 176.25.113.180 at 2022-03-26 10:21:13 +0000
Processing by StaticController#show as HTML
  Parameters: {"id"=>"login"}
Completed 500 Internal Server Error in 9ms (ActiveRecord: 0.0ms | Allocations: 1824)
NoMethodError (undefined method `to_i' for []:Array
Did you mean? to_s
               to_a
               to_h)

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 26, 2022, 11:02am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/5 "2022-03-26T11:02:59Z")

</div>

I think it’s that the selectable avatar setting it on but the avatar list is empty (that’s the empty array that is causing the error, I think) . So you need to either disable selectable avatars or add some avatars. I don’t know how to add them offhand, so disabling the setting I think might work.

---

<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: [March 26, 2022, 11:19am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/6 "2022-03-26T11:19:02Z")

</div>

Sorry for the delay, that took me longer than expected to land on the right words. 🙂

`SiteSetting.selectable_avatars_mode="disabled"`

Running that has now returned my test site to me. 👍

---

<div class="post-metadata">

### Author: ![daming](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daming/32/246799_2.png) [@daming](https://meta.discourse.org/u/daming)
#### Post date: [March 26, 2022, 2:40pm UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/7 "2022-03-26T14:40:36Z")

</div>

Thanks guys, I got it !

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 26, 2022, 4:25pm UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/8 "2022-03-26T16:25:13Z")

</div>

Nice work, @JammyDodger! You can take out some of the guesswork by looking in `conf/site_settings.yml` in the source. They way you can more easily search for what you’re looking for. You can also attach /search in the ux, but here the ux was broken…

Glad you’re back in business @daming!

This does still seem like a bug. I’m sure it’ll get attention after the weekend.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 28, 2022, 6:10am UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/9 "2022-03-28T06:10:17Z")

</div>

We will have a look over the next 7 days or so. Happy we have a workaround.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 28, 2022, 10:42pm UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/12 "2022-03-28T22:42:45Z")

</div>

We have this fixed per:

[https://github.com/discourse/discourse/pull/16302](https://github.com/discourse/discourse/pull/16302)

🎊

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 28, 2022, 10:42pm UTC](https://meta.discourse.org/t/reset-the-user-selectable-avatar-ops-error-500/222032/13 "2022-03-28T22:42:47Z")

</div>


