# Profile preference 404 error/ admin profile not work

**URL:** https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640
**Category:** Bug
**Created:** [January 31, 2022, 10:01pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640 "2022-01-31T22:01:10Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [January 31, 2022, 10:01pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/1 "2022-01-31T22:01:10Z")

</div>

I have this issue since a month; but i try several time upgrade; migrate the database to new one; etc… with no fix.

It was in admin user; i try to migrate the admin data to new one; same issue.. i cannot open the preference or profile and i get 404;

i see same issue but none explain how to fix and it’s quit old since 3 years.

> [@Link to user's preference page (from admin view) returns 404](https://meta.discourse.org/t/link-to-users-preference-page-from-admin-view-returns-404/107424/3):
>
> Thanks for the report. This is already fixed as per the commit below. It will be deployed to your instance soon.

same issue and they mention it’s fixed but too old and none explaine how to fix.

---

<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: [January 31, 2022, 10:06pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/2 "2022-01-31T22:06:58Z")

</div>

> [@f1r4s](#):
>
> migrate the admin data to new one

What does this mean?

Are you using any plugins?

Do you see anything in `/logs` ?

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [January 31, 2022, 10:08pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/3 "2022-01-31T22:08:12Z")

</div>

> [@RGJ](#):
>
> `/logs`

i disabled all the plugin and restore the database with same error, i don’t have any idea.. and this is why i write here.

---

<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: [January 31, 2022, 10:10pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/4 "2022-01-31T22:10:05Z")

</div>

You’ll need to give us _some_ information to work with.

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [January 31, 2022, 10:11pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/5 "2022-01-31T22:11:38Z")

</div>

logs shows this

```plaintext
Job exception: getaddrinfo: No address associated with hostname
2:11 am
NoMethodError (undefined method `url' for nil:NilClass) app/models/badge.rb:306:in `image_url' (eval):10:in `_fast_attributes' lib/freedom_patches/ams_include_without_root.rb:54:in `include!' lib/free

```

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [January 31, 2022, 10:12pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/6 "2022-01-31T22:12:57Z")

</div>

```plaintext
Message

NoMethodError (undefined method `url' for nil:NilClass)
app/models/badge.rb:306:in `image_url'
(eval):10:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
app/controllers/application_controller.rb:510:in `render_json_dump'
app/controllers/users_controller.rb:97:in `block (2 levels) in show'
app/controllers/users_controller.rb:89:in `show'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/request_tracker.rb:198:in `call'

Backtrace

app/models/badge.rb:306:in `image_url'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:99:in `block in attribute'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:448:in `block in merge_association'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `each'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `merge_association'

Env

HTTP HOSTS: site.com

```

---

<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: [February 1, 2022, 6:24am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/7 "2022-02-01T06:24:13Z")

</div>

Have you tried to disable badges and see if that resolves the situation?

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [February 1, 2022, 7:26am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/8 "2022-02-01T07:26:03Z")

</div>

Yes, I try but same issue

---

<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: [February 1, 2022, 7:54am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/9 "2022-02-01T07:54:41Z")

</div>

This seems to be the same issue as you posted before. I’ll link the other topic here in case there’s more info in there that can help people figure out what’s gone wrong:

> [@Badge image missing issue](https://meta.discourse.org/t/badge-image-missing-issue/214455):
>
> Hello, I have issue with badge section, i have modified some badges and add some images there; after 6 months i restore a backup and everything works fine execpt the badge section; i try to login with safe-mode and disable all plugins… but issue still same, how can i restore the badge sections withd default name and images ? error show me Message (2 copies reported) NoMethodError (undefined method `url' for nil:NilClass) app/models/badge.rb:306:in `image\_url' (eval):10:in `\_fast\_attributes' …

I’m not sure I’m following this 100%. Is the issue that you can’t access the admin screen?

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [February 1, 2022, 8:00am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/10 "2022-02-01T08:00:27Z")

</div>

Yes I mention before that I did have this issue month before and try many ways to fix it but everything failed.

Admin screen I can see but I cannot open admin profile, or preference it’s give me 404 error.

---

<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: [February 1, 2022, 8:18am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/11 "2022-02-01T08:18:34Z")

</div>

> [@f1r4s](#):
>
> Admin screen I can see but I cannot open admin profile, or preference it’s give me 404 error.

And you think this maybe because of some custom badges? Are other users with the custom badges affected? If so, could you revoke the custom badges, or delete them entirely?

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [February 1, 2022, 8:20am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/12 "2022-02-01T08:20:06Z")

</div>

Idk how to revoke them or delete them… Is there any guide for that to give a try ?

---

<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: [February 1, 2022, 8:31am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/13 "2022-02-01T08:31:48Z")

</div>

You can edit/revoke a user’s badges from their admin/user page: (if you can access that one)

 ![edit badges](https://global.discourse-cdn.com/meta/original/3X/7/f/7fca6cde05f14bf9a64481d6a352f5c9f341b56a.jpeg)

Or you can delete a custom badge from the Badges section of the admin area:

`[YourSite]/admin/badges`

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [February 1, 2022, 8:36am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/14 "2022-02-01T08:36:51Z")

</div>

> [@JammyDodger](#):
>
> /admin/badges

In prefence or profile i cannot access ( 404 error ); and in badge section (500 error);

`Error code: 500 error`

Maybe i can perfom restore basic badge from database command line ?

```plaintext
Message

Uncaught [object Object]
Url: https://site.com/assets/vendor-3c473d73e5222f7710764282fcc17d73997b7fbd37e0c12afc050b80693ceee2.js
Line: 36
Column: 180628
Window Location: https://site.com/admin/badges

Backtrace

Env

HTTP HOSTS: site.com

```

---

<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: [February 1, 2022, 10:03am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/15 "2022-02-01T10:03:40Z")

</div>

> [@f1r4s](#):
>
> Maybe i can perfom restore basic badge from database command line ?

I don’t think there’s an easy ‘reset’ you can do for the Badges, even from the rails console.

How far did you get with the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) query recommended in the other topic? Have you managed to track down which badge image is causing the issue?

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [February 1, 2022, 10:07am UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/16 "2022-02-01T10:07:24Z")

</div>

No i didn’t, if possible you can have a look ?

---

<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: [February 1, 2022, 12:06pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/17 "2022-02-01T12:06:37Z")

</div>

After a bit of experimenting, I can replicate this glitch (or possibly something similar). I tried using the console to insert a “null” value in the `image_upload_id` in the Badge table, and it filled it with 0 instead. That locked up my test site in a very similar way to what you’ve described.

I ‘fixed’ it by changing all the `image_upload_id` to ‘1’. That allowed me back into my profile and the Badges section, but I now have to manually swop all the badges back to icon only, etc.

To check if yours is a similar problem can you access your data-explorer and create a new query and paste this in (and run):

```plaintext
Select name, image_upload_id
FROM badges b
Order By id desc

```

* * *

> [@JammyDodger](#):
>
> I tried using the console to insert a “null” value in the `image_upload_id`

I have also figured out that it wants ‘nil’ not ‘null’ in the console to work properly. 🙂

This fixed my broken ones without needing to go through them all manually:

```plaintext
Badge.where('image_upload_id=0').find_each do |b|
b.image_upload_id = nil
b.save
end

```

Without knowing exactly what the issue with yours is, I can’t say for sure that will fix yours in the same way - though maybe a ‘change all to nil’ could work for you?

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [February 1, 2022, 4:28pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/18 "2022-02-01T16:28:49Z")

</div>

Hi @jammydodger,

Well it’s show me something like this

 ![Screenshot at 2022-02-01 20-22-59](https://global.discourse-cdn.com/meta/original/3X/d/7/d736ff89e2a23c7d20ffcdc71422bfb962545215.png)

I see most of the badge NULL expect 3 badges have value 17

 ![Screenshot at 2022-02-01 20-28-29](https://global.discourse-cdn.com/meta/original/3X/4/0/40beb20c670486df279660afb2f6e4af65c3e17b.png)

and after i check the profile again; error still again in the “logs”;

```plaintext
Message

NoMethodError (undefined method `url' for nil:NilClass)
app/models/badge.rb:306:in `image_url'
(eval):10:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
app/controllers/application_controller.rb:510:in `render_json_dump'
app/controllers/users_controller.rb:97:in `block (2 levels) in show'
app/controllers/users_controller.rb:89:in `show'
app/controllers/users_controller.rb:103:in `show_card'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/request_tracker.rb:198:in `call'

Backtrace

app/models/badge.rb:306:in `image_url'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:99:in `block in attribute'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:448:in `block in merge_association'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `each'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `merge_association'

Env

HTTP HOSTS: site.com

```

Should i select something else or maybe you prefer to have a look inside with yourself ?

---

<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: [February 1, 2022, 5:00pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/19 "2022-02-01T17:00:30Z")

</div>

> [@f1r4s](#):
>
> and after i check the profile again; error still again in the “logs”;

The [data explorer](https://meta.discourse.org/t/32566?silent=true) query won’t fix the issue, but the information it has given may. 👍

If you’re happy using the rails console you could try the following to reset those 17s to null: (don’t forget to take a back up just in case)

Navigate to the rails console:

```plaintext
cd /var/discourse 
./launcher enter app
rails c

```

Paste this:

```plaintext
Badge.where('image_upload_id=17').find_each do |b|
b.image_upload_id = nil
b.save
end

```

And hopefully that will unlock the Badge section and profile so you can start afresh. 👍🤞

---

<div class="post-metadata">

### Author: ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)
#### Post date: [February 1, 2022, 5:07pm UTC](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640/20 "2022-02-01T17:07:12Z")

</div>

> [@JammyDodger](#):
>
> `end`

Knowledge has no value unless you use it and share it dude! apprecaite your time bro.. fixed!

[Next page](https://meta.discourse.org/t/profile-preference-404-error-admin-profile-not-work/216640.md?page=2)
