# テーマのインストール時に500エラーが発生

**URL:** https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627
**Category:** Development
**Created:** [2024 年 4 月 5 日午後 6:43 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627 "2024-04-05T18:43:58Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 6:43 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/1 "2024-04-05T18:43:58Z")

</div>

これの原因について何かご存知ですか？以前は一度も起こったことがありません。どのソースからインストールしようとしても発生します。

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 7:28 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/2 "2024-04-05T19:28:18Z")

</div>

`/logs` を確認していただけますか？追加を試した後でお願いします。

---

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 7:39 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/3 "2024-04-05T19:39:29Z")

</div>

「ハイジャックされたレスポンスを正しく処理できませんでした : ActiveRecord::RecordNotUnique : PG::UniqueViolation: エラー: 重複キーの値は一意制約に違反しています "theme\_field\_unique\_index"  
詳細: キー (theme\_id, target\_id, type\_id, name)=(50, 5, 1, common/fkb-c-alternative-voting-category) は既に存在します。」

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 7:51 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/4 "2024-04-05T19:51:23Z")

</div>

ああ、これは私がすでに報告した問題に似ているようですね。

> [@Firepup650](#):
>
> Message
> 
> ```plaintext
> Failed to process hijacked response correctly : ActiveRecord::RecordNotUnique : PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_child_themes_on_parent_theme_id_and_child_theme_id"
> DETAIL: Key (parent_theme_id, child_theme_id)=(50, 35) already exists.
> 
> ```

あなたの場合は、私のものとは異なり、試みているテーマID（50）がすでに使用されているようですが、私の場合は親子関係でした。

500エラーが発生する前に、何らかの理由でテーマを追加しようとしましたか？

---

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 7:52 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/5 "2024-04-05T19:52:37Z")

</div>

なので、私が以前使用していたテーマはGHリポジトリにあったのですが、GHがそのアカウントに問題を起こしたため、別のアカウントに移動してアップロードしようとしたところ、このエラーが発生しました。

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 7:53 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/6 "2024-04-05T19:53:14Z")

</div>

テーマはすでにインスタンスにありますか？もしそうなら、古いものを削除すると役立ちますか？

---

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 7:53 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/7 "2024-04-05T19:53:42Z")

</div>

まあ、これを取り除くのは怖いですね。なぜなら、これがインストールできず、テーマが全くなくなってしまうからです、ハハ。

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 7:55 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/8 "2024-04-05T19:55:13Z")

</div>

いえ、よくわかります。念のため、現在のテーマの名前を変更してから、新しいテーマを再インポートしてみてください。（これで何も変わらないと思いますが、害はありません）

---

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 7:55 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/9 "2024-04-05T19:55:27Z")

</div>

それはすでに試しました、ハハ

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 7:59 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/10 "2024-04-05T19:59:47Z")

</div>

私がもっと詳しい人に任せる前の最後のアイデアですが、テーマの `about.json` でテーマの名前を変更してみてください。

---

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 8:06 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/11 "2024-04-05T20:06:21Z")

</div>

ええ、同じ問題です。とても奇妙ですね。1月に発生した500エラーの問題は、その後解決されなかったのでしょうか？それとも、テーマIDを変更する方法はありますか？このようなことが起こらないように、Discourseがインポート時に自動的に処理してくれると思っていました。

あ、エラーログを見ると、アップロードを試みて失敗するたびに、エラーのtheme\_idの部分で数字が1つずつ高くなっているようです。うーん。

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 8:33 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/12 "2024-04-05T20:33:24Z")

</div>

テーマにアタッチされたテーマコンポーネントはありますか？（この時点で、何かが機能することを期待して、とにかく色々なものを試しています。ここから実際にデバッグできる人が来るまで待っても構いません）

---

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 8:33 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/13 "2024-04-05T20:33:59Z")

</div>

はい、数件です。しかし、それらすべてで別のGHアカウントからテーマをインポートしようとするだけで本当に違いが出るでしょうか？

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 8:35 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/14 "2024-04-05T20:35:05Z")

</div>

TCを1つのテーマにまとめたことが、再追加しようとしたときに問題を引き起こしているのではないでしょうか。アップロードしようとしているテーマからTCを削除してみてください。

---

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024 年 4 月 5 日午後 8:36 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/15 "2024-04-05T20:36:51Z")

</div>

すべて削除して、もう一度試しました。問題は同じです。くそー。

いっそテーマを削除することにするかもしれません。エクスポートはありますが、再インポートできるかどうかが賭けです。

奇妙なことに、昨日エクスポートしたものを.zipでアップロードすると、正常にインポートされます…しかし、昨日からかなりの変更を加えました。正常にインポートされる.zipを、解凍して、更新されたファイルをコピーし、再度.zip化してアップロードすると、500エラーが発生します。

編集：テーマを削除して最新のものを再インポートしても、やはりうまくいきませんでした…幸い、少なくとも昨日からのバックアップがありました。さて、どうしたものか…

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2024 年 4 月 5 日午後 10:35 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/16 "2024-04-05T22:35:39Z")

</div>

> [@45thj5ej](#):
>
> もし、正常にインポートされている.zipファイルを展開し、更新されたファイルをコピーして、再度.zip化してアップロードすると、500エラーが発生します。

うーん…それは有望な手がかりですね。一つずつ変更してみて、何が壊れるか確認してみてはどうでしょうか？

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2024 年 4 月 6 日午前 11:07 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/17 "2024-04-06T11:07:26Z")

</div>

これで解決したと思います 🙂

> [@FKB Pro - Social theme](https://meta.discourse.org/t/fkb-pro-social-theme/234323/329?u=don):
>
> Hello wave Is this your fork? [https://github.com/GitHubQueenn/fkb-pro-theme2](https://github.com/GitHubQueenn/fkb-pro-theme2) It seems you created a stylesheets folder which duplicates the scss folder files. This cause the problem because the files duplicated and it tried to import from both folders. If you want to make changes on the style then please create a new theme component or change it in the scss folder or you can use stylesheets name too for folder, but not both. But it is better to keep scss as used by the main repo.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2024 年 5 月 6 日午前 11:08 UTC](https://meta.discourse.org/t/500-error-when-trying-to-install-theme/302627/18 "2024-05-06T11:08:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
