# 500 Internal Server Error when voting on a poll

**URL:** https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480
**Category:** Bug
**Created:** [December 30, 2021, 9:42pm UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480 "2021-12-30T21:42:01Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![kuba-orlik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuba-orlik/32/318490_2.png) [@kuba-orlik](https://meta.discourse.org/u/kuba-orlik)
#### Post date: [December 30, 2021, 9:42pm UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/1 "2021-12-30T21:42:01Z")

</div>

When voting on a poll, all users of my instance get a 500 server error.

There’s an error in the logs:

```plaintext
Message (4 copies reported)

ArgumentError (comparison of Integer with nil failed)
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/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'

Backtrace

plugins/poll/lib/poll.rb:318:in `<'
plugins/poll/lib/poll.rb:318:in `validate_votes!'
plugins/poll/lib/poll.rb:19:in `block in vote'
plugins/poll/lib/poll.rb:368:in `block in change_vote'
activerecord (6.1.4.1) lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
activerecord (6.1.4.1) lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
activesupport (6.1.4.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
activesupport (6.1.4.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
activesupport (6.1.4.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
activesupport (6.1.4.1) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'

Env

HTTP HOSTS: forum.internet-czas-dzialac.pl

```

I’m on the recent versions of the software:

[discourse](https://github.com/discourse/discourse.git) 23b75d8a2b  
[docker\_manager](https://github.com/discourse/docker_manager.git) e5ff940  
[discourse-chat-integration](https://github.com/discourse/discourse-chat-integration) 693c7e9  
styleguide 23b75d8a

What can I do to troubleshoot it?

---

<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: [December 30, 2021, 10:19pm UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/2 "2021-12-30T22:19:49Z")

</div>

Can you reproduce it in a brand new post? Can you repro on meta? What is the Poll markup?

---

<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: [December 30, 2021, 10:48pm UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/3 "2021-12-30T22:48:01Z")

</div>

Repro on meta (leave out the `min` attribute)

```plaintext
[poll type=multiple results=always max=2 chartType=bar]
* a
* b
[/poll]

```

_Poll ([view on site](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/3))_

Caused by this [commit](https://github.com/discourse/discourse/commit/1d0faedfbc3a8b77b971dc70d25e30791dbb6e0b#diff-8b92652067375f4671c1199ee4e945f9a0771d7f10bce6f34fde2cab0d6c544f), `min` is not checked for existence [here](https://github.com/discourse/discourse/commit/1d0faedfbc3a8b77b971dc70d25e30791dbb6e0b#diff-8b92652067375f4671c1199ee4e945f9a0771d7f10bce6f34fde2cab0d6c544fR314-R332) @tgxworld .

---

<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: [December 30, 2021, 10:56pm UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/5 "2021-12-30T22:56:47Z")

</div>

Thanks! We will get this sorted early next week.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [January 5, 2022, 2:02am UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/6 "2022-01-05T02:02:56Z")

</div>

This will be fixed in

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

@kuba-orlik Thank you for reporting and @RGJ thank you for debugging.

---

<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 5, 2022, 8:23am UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/7 "2022-01-05T08:23:42Z")

</div>

The error message for the test poll above is now

`param is missing or the value is empty: options Did you mean? action post_id controller poll_name`

which is a really confusing error.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [January 6, 2022, 2:31am UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/9 "2022-01-06T02:31:51Z")

</div>

Can you provide me with the reproduction step? I can’t seem to get the error which you mentioned above.

---

<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 6, 2022, 10:13am UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/10 "2022-01-06T10:13:45Z")

</div>

Sure.

1. Press the button.

![firefox_xbAvsVUYLA](https://global.discourse-cdn.com/meta/original/3X/4/0/403cbc9d8ea62afd0dd83a00c2fa00eabf72e0cf.gif)

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [January 7, 2022, 1:04am UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/11 "2022-01-07T01:04:56Z")

</div>

O icic this is a different bug because you’re not allowed to vote on a poll without selecting any options.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [January 7, 2022, 3:13am UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/12 "2022-01-07T03:13:54Z")

</div>

This will be fixed in

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

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [January 10, 2022, 12:01am UTC](https://meta.discourse.org/t/500-internal-server-error-when-voting-on-a-poll/213480/13 "2022-01-10T00:01:01Z")

</div>

This topic was automatically closed after 4 days. New replies are no longer allowed.
