# "An empty string is not a valid JSON string" when updating theme component

**URL:** https://meta.discourse.org/t/an-empty-string-is-not-a-valid-json-string-when-updating-theme-component/319476
**Category:** Bug
**Tags:** brand-header, fixed
**Created:** [July 31, 2024, 2:39pm UTC](https://meta.discourse.org/t/an-empty-string-is-not-a-valid-json-string-when-updating-theme-component/319476 "2024-07-31T14:39:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [July 31, 2024, 2:39pm UTC](https://meta.discourse.org/t/an-empty-string-is-not-a-valid-json-string-when-updating-theme-component/319476/1 "2024-07-31T14:39:47Z")

</div>

When updating a theme component the following error occurs.

```plaintext
Failed to update Brand Header Theme Component
An empty string is not a valid JSON string.
/var/www/discourse/lib/theme_settings_manager/objects.rb:13:in `parse'
/var/www/discourse/lib/theme_settings_manager/objects.rb:13:in `value='
/var/www/discourse/app/models/theme.rb:760:in `update_setting'
/var/www/discourse/app/models/theme.rb:881:in `block (2 levels) in migrate_settings'
/var/www/discourse/app/models/theme.rb:880:in `each'
/var/www/discourse/app/models/theme.rb:880:in `block in migrate_settings'
/var/www/discourse/app/models/theme.rb:919:in `migrate_settings'
/var/www/discourse/app/models/remote_theme.rb:377:in `block in update_from_remote'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:535:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/transactions.rb:212:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/active_record/transactions.rb:301:in `transaction'
/var/www/discourse/app/models/remote_theme.rb:383:in `update_from_remote'

```

This is about [GitHub - discourse/discourse-brand-header: Brand header theme component for Discourse · GitHub](https://github.com/discourse/discourse-brand-header) which is being updated from `5b0c2da` to `f458dc9` (because Discourse is being updated from 3.2.4 to 3.3.0).

The reason this is happening is that the “links” field is empty and the update logic apparently cannot handle that @tgxworld

Workaround:

- enter `foo,https://example.com,bar` in “links” field
- update theme component
- open editor for links and remove the entry

However, this workaround is hard to automate… 😭

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [August 1, 2024, 1:11am UTC](https://meta.discourse.org/t/an-empty-string-is-not-a-valid-json-string-when-updating-theme-component/319476/3 "2024-08-01T01:11:26Z")

</div>

I’ll have a look at this today.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [August 1, 2024, 6:00am UTC](https://meta.discourse.org/t/an-empty-string-is-not-a-valid-json-string-when-updating-theme-component/319476/4 "2024-08-01T06:00:36Z")

</div>

This has been fixed in

[https://github.com/discourse/discourse-brand-header/pull/50](https://github.com/discourse/discourse-brand-header/pull/50)

Likely to be merged and released within the next 24 hours.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [August 5, 2024, 12:00am UTC](https://meta.discourse.org/t/an-empty-string-is-not-a-valid-json-string-when-updating-theme-component/319476/6 "2024-08-05T00:00:41Z")

</div>

This topic was automatically closed after 3 days. New replies are no longer allowed.
