# Top Menu Removal Crashes Site

**URL:** https://meta.discourse.org/t/top-menu-removal-crashes-site/49471
**Category:** Bug
**Created:** [31. August 2016 um 04:17 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471 "2016-08-31T04:17:28Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@charles](https://meta.discourse.org/u/charles)
#### Post date: [31. August 2016 um 04:17 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/1 "2016-08-31T04:17:28Z")

</div>

It seems if I remove each item for top menu, save and then try to refresh the main page, it “crashes” and gives me a blank page. If I then go back and reset, the blank page goes back to regular view.

Anyone else having this issue using the latest build?

---

<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: [31. August 2016 um 04:21 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/2 "2016-08-31T04:21:05Z")

</div>

Exactly what are you removing and how ?

What error message(s) does the console show ?

---

<div class="post-metadata">

### Author: ![charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@charles](https://meta.discourse.org/u/charles)
#### Post date: [31. August 2016 um 04:25 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/3 "2016-08-31T04:25:02Z")

</div>

Under basic setup, I was removing all the items listed under top menu

I’m guessing it “crashes” because when the menu item ‘latest’ is removed, there is no view to show?

---

<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: [31. August 2016 um 04:37 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/4 "2016-08-31T04:37:41Z")

</div>

Well, you didn’t answer my questions so I can only guess.

You are not removing by using CSS display none, but are emptying this Admin → Settings → Basic Setup input ?

> top menu

> Determine which items appear in the homepage navigation, and in what order. Example latest|new|unread|categories|top|read|posted|bookmarks

This being empty is not really a Bug as it isn’t normal to have no navigation.

But I think it might be a good idea to force it to have at least one. Or if not that, maybe include a Warning in the copy.

TBH I don’t know how many Warnings Discourse should have. It could make things quite noisy to have a lot of “if you do this weird unusual thing there will be breakage” warnings all over the place.

---

<div class="post-metadata">

### Author: ![charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@charles](https://meta.discourse.org/u/charles)
#### Post date: [31. August 2016 um 04:45 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/5 "2016-08-31T04:45:02Z")

</div>

Sorry I didn’t answer about the error from console. How can I obtain that for you?

---

<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: [31. August 2016 um 04:51 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/6 "2016-08-31T04:51:46Z")

</div>

> [@charles](#):
>
> How can I obtain that for you?

AFAIK most browsers it’s under “tools”  
But it might be easier to press F12

Once the dev tools open if it isn’t already open to “console” go to it, reload the page and any JavaScript errors and other messages should show there.

---

<div class="post-metadata">

### Author: ![charles](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@charles](https://meta.discourse.org/u/charles)
#### Post date: [31. August 2016 um 05:09 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/7 "2016-08-31T05:09:07Z")

</div>

The only item that shows up is

Get [http://example.com/](http://example.com/) HTTP/1.1 500 Internal Server Error 25ms

As you mentioned it’s not a bug. I will simply reset and instead use CSS display none for category-breadcrumb and the nav-pills

Thanks for looking into it.

---

<div class="post-metadata">

### Author: ![jnns](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jnns/32/66896_2.png) [@jnns](https://meta.discourse.org/u/jnns)
#### Post date: [26. Januar 2017 um 13:09 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/8 "2017-01-26T13:09:09Z")

</div>

Being able to empty the settings field and the app logic relying on at least one value being present is most definitely a bug as it renders the site inaccessible (at least the index, that is)!

I emptied the settings field and upon the next login was greeted with just an HTTP500 error with no clue on how to resolve this. Only after digging through the logs of the Docker container, finding this:

```
Redirected to https://discourse.example.com/
Completed 302 Found in 18ms (ActiveRecord: 4.6ms)
Started GET "/" for xxx.xxx.xxx.xxx at 2017-01-26 12:39:52 +0000
NoMethodError (undefined method `name' for nil:NilClass)
/var/www/discourse/app/models/site_setting.rb:65:in `homepage'

```

and reading up on in in the source code on GitHub

```
def self.top_menu_items
 top_menu.split('|').map { |menu_item| TopMenuItem.new(menu_item) }
end

def self.homepage
  top_menu_items[0].name
end

```

then I tried to open up the admin panel and was able to set a default value for `top_menu_items` again.

There needs to be a way to prevent the user from deleting all `top_menu_items` or a check for an empty setting so that the site keeps being functional.

---

<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: [30. August 2018 um 06:12 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/9 "2018-08-30T06:12:55Z")

</div>

We have a validator now, so this can no longer happen.

---

<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: [31. August 2018 um 08:00 UTC](https://meta.discourse.org/t/top-menu-removal-crashes-site/49471/10 "2018-08-31T08:00:00Z")

</div>

This topic was automatically closed after 25 hours. New replies are no longer allowed.
