# NoMethodError (undefined method \`id' for #\<Guardian…

**URL:** https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400
**Category:** Support
**Created:** [November 14, 2023, 8:46am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400 "2023-11-14T08:46:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 14, 2023, 8:46am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/1 "2023-11-14T08:46:58Z")

</div>

I’ve gotten these some days time now. Everything seems working, but surely I don’t know what is happening under the hood. Should I be worried or do something? Is is coming fron an attempt to delete anon-post?

Discourse is updated about 10 hours ago…

```plaintext
Message (16 copies reported)

NoMethodError (undefined method `id' for #<Guardian::AnonymousUser:0x00007f5fe7ae9ea0>)
lib/guardian.rb:624:in `is_my_own?'
lib/guardian/post_guardian.rb:262:in `can_delete_post_action?'
app/controllers/application_controller.rb:422:in `block in with_resolved_locale'
app/controllers/application_controller.rb:422:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:387:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:233:in `call'

Backtrace

lib/guardian.rb:624:in `is_my_own?'
lib/guardian/post_guardian.rb:262:in `can_delete_post_action?'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:230:in `format_like_user'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:236:in `block in format_likes_users'
activerecord (7.0.7) lib/active_record/relation/delegation.rb:88:in `each'
activerecord (7.0.7) lib/active_record/relation/delegation.rb:88:in `each'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:236:in `map'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:236:in `format_likes_users'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:160:in `post_reactions_users'
actionpack (7.0.7) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'

Env

HTTP HOSTS: foorumi.katiska.eu

```

---

<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: [November 14, 2023, 9:29am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/2 "2023-11-14T09:29:01Z")

</div>

I could be wrong, but it looks like an Anonymous Mode user is having trouble deleting a post?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 14, 2023, 9:40am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/3 "2023-11-14T09:40:43Z")

</div>

I’m quite sure there is no such case. I would bet it must be something automatic process happening on background, and I can’t undestand that either.

On my forum anon-posting happends almost never and even then it was by regular users. There is small chance I’ve deleted some old and non-relevant topics, but I can’t remember there would be anons either. And yes, my forum is so low traffic that I can rely my memory over SQL 🤣

I had one user who didn`t confirm email for some reasons and system killed his account some days ago. All he did was giving likes, nothing else. And now I have a feeling (sorry I can’t give more solid info) that error started popping up at same time.

---

<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: [November 14, 2023, 9:46am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/4 "2023-11-14T09:46:21Z")

</div>

It is connected to Discourse Reactions somehow, so the giving of Likes could be relevant.

How did they manage to interact without first verifying their email/activating their account?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 14, 2023, 9:58am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/6 "2023-11-14T09:58:12Z")

</div>

> [@JammyDodger](#):
>
> without first verifying their email/activating their account?

Good question.

I had installed [Disable Email Verification for Discourse Plugin](https://meta.discourse.org/t/disable-email-verification-for-discourse-plugin/280874) but it was disabled at that moment. Could it leak somehow? But still… I don’t follow common rules because I don’t have spam issues (one benefit when is part of language minority…) so I give TL1 right away after registration so that could break things too?

So… is there something somewhere I can start digging? And the most important question: will world come to its end if I don’t do anythind?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 14, 2023, 10:14am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/8 "2023-11-14T10:14:35Z")

</div>

It may or may not has something to do at least with that automatic TL1, but with `disable email verification` too. I have these several times with same user all the time:

```plaintext
id: 606
username: saja
name: Saja
created_at: 2023-10-28 14:34:13 UTC
trust_level: 1
last_seen_at: 
last_emailed_at:

```

2.11., 28.10., 12.10., and 27.9. Strange is that admin log doesn’t show any IP addresses for that user. Every other deletion for non activate accounts show IP.

---

<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: [November 14, 2023, 10:47am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/9 "2023-11-14T10:47:21Z")

</div>

It’s looking like it’s connected to the `allow_anonymous_likes` setting somehow.

I’ve had a bit of a play to see if I can trigger the same error, but entering Anonymous Mode and throwing some Likes/Reactions around and then removing them or deleting the posts hasn’t triggered it. I also toggled off `allow_anonymous_likes` midway through and there was no conflict, it just disallowed being able to remove them. It also respected the `post undo action window mins` setting too.

I am not sure. 🤔

---

<div class="post-metadata">

### Author: ![codergautam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codergautam/32/261083_2.png) [@codergautam](https://meta.discourse.org/u/codergautam)
#### Post date: [November 20, 2023, 3:20am UTC](https://meta.discourse.org/t/nomethoderror-undefined-method-id-for-guardian/285400/10 "2023-11-20T03:20:54Z")

</div>

Hey, sorry that it could be linked to my plugin. Could you try disabling it and see if that fixes it? Haven’t had much time to work on it but if it’s related to my plugin do let me know and I’ll take a look. I want to provide as much support as I can to users of my plugin.

Have it enabled [here](https://iogames.forum) and have no issues except for the ones explicitly mentioned on the thread. (Although I don’t have the auto TL1 you have)
