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

When updating a theme component the following error occurs.

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 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… :sob:

4 Likes

I’ll have a look at this today.

3 Likes

This has been fixed in

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

4 Likes

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