# Error when creating a new Badge

**URL:** https://meta.discourse.org/t/error-when-creating-a-new-badge/121828
**Category:** Bug
**Created:** [7월 1, 2019, 8:47오후 UTC](https://meta.discourse.org/t/error-when-creating-a-new-badge/121828 "2019-07-01T20:47:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [7월 1, 2019, 8:47오후 UTC](https://meta.discourse.org/t/error-when-creating-a-new-badge/121828/1 "2019-07-01T20:47:52Z")

</div>

I have an issue when creating a new Badge on my Discourse v2.4.0.beta1 +7

I did compare to latest: [https://github.com/discourse/discourse/compare/34f382b…dc5eb76](https://github.com/discourse/discourse/compare/34f382b...dc5eb76) but saw no mention of a Badge fix, hence this bug report.

Steps to reproduce:

1. Fill in the relevant parts of the form and click Save button

2. The message ‘Saving…’ appears, and does not then disappear:

 ![23](https://global.discourse-cdn.com/meta/original/3X/d/6/d6c4bce055fda683cac44aea01e267a37fa13b75.png)

1. A console error is caught re `ace.js`

 ![16](https://global.discourse-cdn.com/meta/original/3X/b/2/b2c48d6b94dca28e2b9e3a9d6b3e49dbd5ff02dc.png)

1. Clicking away from the page throws a browser message asking if I’m sure I want to leave that page

2. The badge _does_ get created successfully 👍🏻

Able to reproduce on both Safari 12.1.1 and Firefox 65.0.1

---

<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: [7월 1, 2019, 11:15오후 UTC](https://meta.discourse.org/t/error-when-creating-a-new-badge/121828/2 "2019-07-01T23:15:40Z")

</div>

Confirmed! Thanks heaps for the report. @techAPJ can you investigate and fix.

If this impacts “stable” we should back port the fix.

---

<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: [7월 2, 2019, 9:54오전 UTC](https://meta.discourse.org/t/error-when-creating-a-new-badge/121828/4 "2019-07-02T09:54:13Z")

</div>

Taking a quick look at this, the create (Save) process fails if there is no badge query present. Fixed via:

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

Backported to beta and stable.

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [7월 2, 2019, 2:57오후 UTC](https://meta.discourse.org/t/error-when-creating-a-new-badge/121828/5 "2019-07-02T14:57:29Z")

</div>

Thanks for the quick fix @techAPJ 👍🏻

---

<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: [7월 3, 2019, 3:56오전 UTC](https://meta.discourse.org/t/error-when-creating-a-new-badge/121828/6 "2019-07-03T03:56:42Z")

</div>


