# 导入或创建主题导致 500 错误

**URL:** https://meta.discourse.org/t/importing-or-creating-a-theme-causes-a-500-error/92486
**Category:** Support
**Created:** [2018年七月16日 18:53 UTC](https://meta.discourse.org/t/importing-or-creating-a-theme-causes-a-500-error/92486 "2018-07-16T18:53:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sirideain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sirideain/32/101202_2.png) [@sirideain](https://meta.discourse.org/u/sirideain)
#### Post date: [2018年七月16日 18:53 UTC](https://meta.discourse.org/t/importing-or-creating-a-theme-causes-a-500-error/92486/1 "2018-07-16T18:53:47Z")

</div>

Hi,

I updated to c0c2634 today and now I can’t import or create a theme. Importing says **500 Error** and creating a new theme says **Internal Server Error**. There are no other details in the dialog. I have a test instance that is on b459a58 and I was able to import successfully there.

Here is the error from the logs:

> ActiveRecord::NotNullViolation (PG::NotNullViolation: ERROR: null value in column “key” violates not-null constraint  
> DETAIL: Failing row contains (7, Alternative Logos, 1, null, 2018-07-16 18:45:42.528877, 2018-07-16 18:45:42.528877, 0, f, f, null, 5).  
> : INSERT INTO “themes” (“name”, “user\_id”, “created\_at”, “updated\_at”, “remote\_theme\_id”) VALUES (‘Alternative Logos’, 1, ‘2018-07-16 18:45:42.528877’, ‘2018-07-16 18:45:42.528877’, 5) RETURNING “id”)  
> /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:95:in `exec’

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [2018年七月16日 19:41 UTC](https://meta.discourse.org/t/importing-or-creating-a-theme-causes-a-500-error/92486/3 "2018-07-16T19:41:38Z")

</div>

Hi @sirideain

Can you do a rebuild and let me know if that fixes the problem?

---

<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: [2018年七月16日 23:45 UTC](https://meta.discourse.org/t/importing-or-creating-a-theme-causes-a-500-error/92486/4 "2018-07-16T23:45:54Z")

</div>

@david just fixed this per:

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

Be sure to upgrade Discourse ASAP.

---

<div class="post-metadata">

### Author: ![sirideain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sirideain/32/101202_2.png) [@sirideain](https://meta.discourse.org/u/sirideain)
#### Post date: [2018年七月17日 00:35 UTC](https://meta.discourse.org/t/importing-or-creating-a-theme-causes-a-500-error/92486/5 "2018-07-17T00:35:04Z")

</div>

This fixed it. Thank you for the fast response.

---

<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: [2018年七月17日 00:39 UTC](https://meta.discourse.org/t/importing-or-creating-a-theme-causes-a-500-error/92486/6 "2018-07-17T00:39:53Z")

</div>


