# Validation error: unique\_post\_validator() doesn't know who the acting user is

**URL:** https://meta.discourse.org/t/validation-error-unique-post-validator-doesnt-know-who-the-acting-user-is/50241
**Category:** Support
**Created:** [September 16, 2016, 1:38pm UTC](https://meta.discourse.org/t/validation-error-unique-post-validator-doesnt-know-who-the-acting-user-is/50241 "2016-09-16T13:38:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mc0e](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@mc0e](https://meta.discourse.org/u/mc0e)
#### Post date: [September 16, 2016, 1:38pm UTC](https://meta.discourse.org/t/validation-error-unique-post-validator-doesnt-know-who-the-acting-user-is/50241/1 "2016-09-16T13:38:03Z")

</div>

I’m seeing similar errors on at least 2 different discourse installations. Does anyone have any idea what the following is about?

The most serious manifestation is when trying to post from the web interface, which fails with a 500 error. the rails/production.log has the following:

> ```
> Started POST "/posts" for 212.139.89.48 at 2016-09-15 10:56:19 +0000
> Processing by PostsController#create as JSON
> Parameters: {"raw"=>"If you are applying for a person over 18 and they need someone to accompany them on the bus you will need to get a letter from their Doctor stating that they cannot travel without support. That way they will be able to get a +1. If under 18 thats not a problem", "unlist_topic"=>"false", "category"=>"6", "topic_id"=>"1029", "is_warning"=>"false", "whisper"=>"false", "archetype"=>"regular", "typing_duration_msecs"=>"29600", "composer_open_duration_msecs"=>"123882", "reply_to_post_number"=>"1", "nested_post"=>"true"}
> Completed 500 Internal Server Error in 191ms (ActiveRecord: 2.5ms)
> NoMethodError (undefined method `staff?' for nil:NilClass)
> /var/www/discourse/lib/validators/post_validator.rb:94:in `unique_post_validator'
> 
> ```

I also see another variant, which turns up in an email which is copied in the production.log file. The email contains a similar error, but this time with a backtrace:

> Unrecognized error type (NoMethodError: undefined method `staff?’ for nil:NilClass) when processing incoming email

> Backtrace:  
> /var/www/discourse/lib/validators/post\_validator.rb:94:in `unique_post_validator' /var/www/discourse/lib/validators/post_validator.rb:20:in `validate’  
> /var/www/discourse/lib/new\_post\_manager.rb:85:in `default_handler' /var/www/discourse/lib/new_post_manager.rb:133:in `call’  
> /var/www/discourse/lib/new\_post\_manager.rb:133:in `block in perform' /var/www/discourse/lib/new_post_manager.rb:132:in `any?’  
> /var/www/discourse/lib/new\_post\_manager.rb:132:in `perform' /var/www/discourse/lib/email/receiver.rb:501:in `create\_post’  
> /var/www/discourse/lib/email/receiver.rb:470:in `create_post_with_attachments' /var/www/discourse/lib/email/receiver.rb:427:in `create\_reply’  
> /var/www/discourse/lib/email/receiver.rb:348:in `process_destination' /var/www/discourse/lib/email/receiver.rb:101:in `block in process\_internal’  
> /var/www/discourse/lib/email/receiver.rb:99:in `yield' /var/www/discourse/lib/email/receiver.rb:99:in `yield’  
> /var/www/discourse/lib/email/receiver.rb:99:in `each' /var/www/discourse/lib/email/receiver.rb:99:in `each’  
> /var/www/discourse/lib/email/receiver.rb:99:in `each' /var/www/discourse/lib/email/receiver.rb:99:in `each’  
> /var/www/discourse/lib/email/receiver.rb:99:in `each' /var/www/discourse/lib/email/receiver.rb:99:in `each’  
> /var/www/discourse/lib/email/receiver.rb:99:in `process_internal' /var/www/discourse/lib/email/receiver.rb:43:in `process!’  
> /var/www/discourse/lib/email/processor.rb:17:in `process!' /var/www/discourse/lib/email/processor.rb:11:in `process!’  
> /var/www/discourse/app/jobs/scheduled/poll\_mailbox.rb:25:in `process_popmail' /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:36:in `block (2 levels) in poll\_pop3’  
> /usr/local/lib/ruby/2.3.0/net/pop.rb:689:in `block in delete_all' /usr/local/lib/ruby/2.3.0/net/pop.rb:688:in `each’  
> /usr/local/lib/ruby/2.3.0/net/pop.rb:688:in `delete_all' /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:35:in `block in poll\_pop3’  
> /usr/local/lib/ruby/2.3.0/net/pop.rb:532:in `start' /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:34:in `poll\_pop3’  
> /var/www/discourse/app/jobs/scheduled/poll\_mailbox.rb:16:in `execute' /var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform’

---

<div class="post-metadata">

### Author: ![mc0e](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@mc0e](https://meta.discourse.org/u/mc0e)
#### Post date: [September 16, 2016, 2:46pm UTC](https://meta.discourse.org/t/validation-error-unique-post-validator-doesnt-know-who-the-acting-user-is/50241/2 "2016-09-16T14:46:25Z")

</div>

Some more info.

- The problem started when the last discourse update was put through from within the discourse web interface
- `launcher rebuild` doesn’t fix it.
- It seems it matters who the posting user is. Provisionally, it might be that higher trust level users are affected and low trust level not so. An admin user with low trust level is not affected.

---

<div class="post-metadata">

### Author: ![harleyqmc](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@harleyqmc](https://meta.discourse.org/u/harleyqmc)
#### Post date: [September 16, 2016, 4:21pm UTC](https://meta.discourse.org/t/validation-error-unique-post-validator-doesnt-know-who-the-acting-user-is/50241/3 "2016-09-16T16:21:44Z")

</div>

getting the same error on posting replies…not all users or all replies :

Completed 500 Internal Server Error in 134ms (ActiveRecord: 4.3ms)  
NoMethodError (undefined method `staff?' for nil:NilClass) /var/www/discourse/lib/validators/post_validator.rb:94:in `unique\_post\_validator’

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 16, 2016, 9:05pm UTC](https://meta.discourse.org/t/validation-error-unique-post-validator-doesnt-know-who-the-acting-user-is/50241/4 "2016-09-16T21:05:20Z")

</div>

I believe this bug was already fixed today, so pull latest and rebuild?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 16, 2016, 9:05pm UTC](https://meta.discourse.org/t/validation-error-unique-post-validator-doesnt-know-who-the-acting-user-is/50241/5 "2016-09-16T21:05:22Z")

</div>


