# \<forum\>/search returns 500 error

**URL:** https://meta.discourse.org/t/forum-search-returns-500-error/41277
**Category:** Bug
**Created:** [March 18, 2016, 5:19pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277 "2016-03-18T17:19:56Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![ErikV](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ErikV](https://meta.discourse.org/u/ErikV)
#### Post date: [March 18, 2016, 5:19pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/1 "2016-03-18T17:19:57Z")

</div>

On my forum and on this forum, if I go to http:// forum address /search I get a 500 error.

Any known workarounds?

Thanks!

---

<div class="post-metadata">

### Author: ![tibarra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tibarra/32/52222_2.png) [@tibarra](https://meta.discourse.org/u/tibarra)
#### Post date: [March 18, 2016, 5:27pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/2 "2016-03-18T17:27:44Z")

</div>

> [@ErikV](#):
>
> http:///search

Can you give the complete address?

---

<div class="post-metadata">

### Author: ![ErikV](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ErikV](https://meta.discourse.org/u/ErikV)
#### Post date: [March 18, 2016, 5:29pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/3 "2016-03-18T17:29:10Z")

</div>

[https://meta.discourse.org/search](https://meta.discourse.org/search)

---

<div class="post-metadata">

### Author: ![tibarra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tibarra/32/52222_2.png) [@tibarra](https://meta.discourse.org/u/tibarra)
#### Post date: [March 18, 2016, 5:31pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/4 "2016-03-18T17:31:07Z")

</div>

I’m not sure if this is a correct address for this application, is it? @zogstrip @codinghorror @sam

---

<div class="post-metadata">

### Author: ![ErikV](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ErikV](https://meta.discourse.org/u/ErikV)
#### Post date: [March 18, 2016, 5:33pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/5 "2016-03-18T17:33:42Z")

</div>

I’m not 100% sure it worked on this forum before, but it definitely worked on mine: [http://talk.sparrowbrowser.com/search](http://talk.sparrowbrowser.com/search)

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [March 18, 2016, 5:33pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/6 "2016-03-18T17:33:57Z")

</div>

This looks like a legit bug, though not high priority since few people will find themselves here.

If you search for e.g.

> [https://community.namati.org/search?q=community%20land%20protection](https://community.namati.org/search?q=community%20land%20protection)

you get results.

But if you visit ..

> [https://community.namati.org/search](https://community.namati.org/search)

.. or even ..

> [https://community.namati.org/search?q=](https://community.namati.org/search?q=)

.. you get an ugly error.

Would be more sensible to be shown a blank search form ready to be used to search for something.

---

<div class="post-metadata">

### Author: ![ErikV](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ErikV](https://meta.discourse.org/u/ErikV)
#### Post date: [March 18, 2016, 5:36pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/7 "2016-03-18T17:36:41Z")

</div>

Yeah, using the magnifying glass link works just fine. For us this is an issue because we liked the /search page a lot and are pointing people toward it.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [March 18, 2016, 5:43pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/8 "2016-03-18T17:43:08Z")

</div>

> [@tobiaseigen](#):
>
> . you get an ugly error.

Not what I’m getting using Firefox by a direct click on the link

 ![](https://global.discourse-cdn.com/meta/original/3X/4/f/4f3590f2a6d7a71bd1c27aa048e51e8103049bed.png)

But if I put the URL into the address bar I get a blank page.

A relative link thing?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [March 18, 2016, 5:45pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/9 "2016-03-18T17:45:14Z")

</div>

Weird, I get a Server 500 error

 ![](https://global.discourse-cdn.com/meta/original/3X/c/5/c53306866fa1dfa516af474de1676ddf942cba08.png)

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [March 18, 2016, 5:46pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/10 "2016-03-18T17:46:03Z")

</div>

me too. In Chrome, I get the server 500 error, here on meta and in our community.

 ![](https://global.discourse-cdn.com/meta/original/3X/1/8/18f236a141d4677bb2d5c7df041e4e95ebcbdef8.png)

---

<div class="post-metadata">

### Author: ![tibarra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tibarra/32/52222_2.png) [@tibarra](https://meta.discourse.org/u/tibarra)
#### Post date: [March 18, 2016, 6:02pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/11 "2016-03-18T18:02:45Z")

</div>

Seems that the bug is in chrome, i got and error too.

---

<div class="post-metadata">

### Author: ![ErikV](https://avatars.discourse-cdn.com/v4/letter/e/f475e1/32.png) [@ErikV](https://meta.discourse.org/u/ErikV)
#### Post date: [March 18, 2016, 6:04pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/12 "2016-03-18T18:04:08Z")

</div>

Interesting to know that it’s browser-dependent!

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [March 18, 2016, 6:04pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/13 "2016-03-18T18:04:36Z")

</div>

I can repro this issue locally, working on a fix now.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [March 18, 2016, 6:10pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/14 "2016-03-18T18:10:06Z")

</div>

Fixed via:

[https://github.com/discourse/discourse/commit/a7eec3da5c9af2f8d03b65453bdfbad214f05757](https://github.com/discourse/discourse/commit/a7eec3da5c9af2f8d03b65453bdfbad214f05757)

Was related to [this commit](https://github.com/discourse/discourse/commit/50f7616d0491091bf575e962f4652b56bdfcd61c).

cc @sam

---

<div class="post-metadata">

### Author: ![tibarra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tibarra/32/52222_2.png) [@tibarra](https://meta.discourse.org/u/tibarra)
#### Post date: [March 18, 2016, 6:33pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/15 "2016-03-18T18:33:05Z")

</div>

Can you explain me how the ‘if result’ works in this case? I will appreciate it a lot.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [March 18, 2016, 6:34pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/16 "2016-03-18T18:34:13Z")

</div>

It will only run `find_user_data(guardian)` on `result`, if `result` has a value. In this case, since you are visitng /search directly, there is no result

---

<div class="post-metadata">

### Author: ![tibarra](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tibarra/32/52222_2.png) [@tibarra](https://meta.discourse.org/u/tibarra)
#### Post date: [March 18, 2016, 6:37pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/17 "2016-03-18T18:37:53Z")

</div>

Oh i got it! Thanks for the explanation, cheers! I think this post should be closed right?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [March 18, 2016, 6:43pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/18 "2016-03-18T18:43:29Z")

</div>

> [@tibarra](#):
>
> I think this post should be closed right?

Yep, search page loads fine now: [Search results for '' - Discourse Meta](https://meta.discourse.org/search)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [March 18, 2016, 6:43pm UTC](https://meta.discourse.org/t/forum-search-returns-500-error/41277/19 "2016-03-18T18:43:32Z")

</div>


