500 Error when trying to install theme

Any idea what causes this? Never had it happen before. Happens when trying to install from any source.

Could you check /logs after trying to add one?

Failed to process hijacked response correctly : ActiveRecord::RecordNotUnique : PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “theme_field_unique_index”
DETAIL: Key (theme_id, target_id, type_id, name)=(50, 5, 1, common/fkb-c-alternative-voting-category) already exists.

Ah, this seems similar to an issue I already reported then:

Although in your case it looks like the theme ID it’s trying to use (50) is already in-use, instead of the parent-child link like mine was.

Did you add a theme earlier that failed for any reason before the 500s started?

1 Like

So, the original theme I use was on a GH repository. GH messed with the account I had it on, so I put it on another account and tried uploading it and then was getting this error.

So is the theme already on your instance? If that’s the case, does removing the old one help?

Well, I’m afraid to remove it since this one won’t install and then have no theme at all, haha.

Ha, no I completely get that. Just for a sanity thing, could you try renaming your current theme, and then re-import the new one? (I don’t expect this to change anything, but it can’t hurt)

Tried that already, haha

Last idea before I leave this to someone who knows more than me, could you try renaming the theme in the theme’s about.json?

Yeah, same issue. So weird. I guess the 500 Error issue you got in January wasn’t resolved then? Or is there any way to just change the theme ID? I would’ve thought Discourse would automatically make that happen on import so that something like this doesn’t happen

Oh wait, in the error log, it looks like everytime i try to upload it and it fails, it’s trying 1 number higher on the theme_id part of the error. hmmm

Do you have any theme components attached to your theme? (At this point, I’m just throwing stuff at the wall in the hopes something works, feel free to wait for someone who actually knows what to debug from here)

Yes, a handful. Would simply trying to import the theme just from another GH account really matter with all that, though?

I’m wondering if having the TCs on one theme is causing problems when you try to re-add it, could you try removing the TCs from the theme you’re uplaoding?

Removed them all, tried again. Same issue. Darn.

Might bite the bullet and just delete the theme. I have an export of it, but the whole gamble is hoping it’ll let me even re-import it.

Oddly enough, if I upload a .zip of an export I have from yesterday, it imports fine…but I’ve changed a looot since yesterday on it. If I then take that .zip that is importing fine, extract it, copy the updated files to it, re-.zip it, and upload, it gives 500 Error.

EDIT: Deleting the theme and re-importing the most updated one did in fact still NOT work…thank God I had a backup at least from yesterday. Now what?..

Hm… that’s a potential lead, try changing things one by one, and see what breaks?

I think this one solved here :slightly_smiling_face:

1 Like