# Missing 'theme\_fields' and rake db:migrate SyntaxError failure

**URL:** https://meta.discourse.org/t/missing-theme-fields-and-rake-db-migrate-syntaxerror-failure/238187
**Category:** Self-hosting
**Created:** [September 5, 2022, 11:25pm UTC](https://meta.discourse.org/t/missing-theme-fields-and-rake-db-migrate-syntaxerror-failure/238187 "2022-09-05T23:25:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![SoothSinger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soothsinger/32/273050_2.png) [@SoothSinger](https://meta.discourse.org/u/SoothSinger)
#### Post date: [September 5, 2022, 11:25pm UTC](https://meta.discourse.org/t/missing-theme-fields-and-rake-db-migrate-syntaxerror-failure/238187/1 "2022-09-05T23:25:19Z")

</div>

Hello all,

I’m trying to perform a new install of Discourse v2.8.8 on Debian Buster (in Docker). Currently the Sidekiq tasks are erroring with the below error relating to `theme_fields` :

```plaintext
2022-09-06 08:25:53.301 AEST [1205] ERROR: relation "theme_fields" does not exist at character 454
2022-09-06 08:25:53.301 AEST [1205] STATEMENT: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
 	       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
	       c.collname, col_description(a.attrelid, a.attnum) AS comment
	  FROM pg_attribute a
	  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
	  LEFT JOIN pg_type t ON a.atttypid = t.oid
 	  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
 	 WHERE a.attrelid = '"theme_fields"'::regclass
	   AND a.attnum > 0 AND NOT a.attisdropped
 	 ORDER BY a.attnum

```

Searching through the forums, this is a similar error to post [Restore problem relation theme\_fields does not exist](https://meta.discourse.org/t/restore-problem-relation-theme-fields-does-not-exist/95500); which unfortunately does not have a resolution so far.

Investigating deeper into this, it _seems_ that this is related to the `db:migrate` task failure in my case (it’s a guess)  
Executing `RAILS_ENV=test bin/rails db:migrate` in a terminal returns a SyntaxError below:

```plaintext
rails aborted!
SyntaxError: /app/lib/tasks/assets.rake:294: syntax error, unexpected '}', expecting `end'
/app/lib/tasks/assets.rake:306: syntax error, unexpected `end', expecting '}'
/app/lib/tasks/assets.rake:418: class definition in method body
  class Sprockets::Manifest
  ^ ~~~~~~~~~~~~~~~~~~~~~~~~
/app/lib/tasks/assets.rake:430: syntax error, unexpected end-of-input, expecting `end'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/usr/local/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:326:in `block in load'
/usr/local/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/local/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:326:in `load'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/engine.rb:675:in `block in run_tasks_blocks'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/engine.rb:675:in `each'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/engine.rb:675:in `run_tasks_blocks'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application.rb:528:in `run_tasks_blocks'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/engine.rb:464:in `load_tasks'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
/app/Rakefile:9:in `<main>'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/command.rb:50:in `invoke'
/usr/local/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/commands.rb:18:in `<main>'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:105:in `register'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
bin/rails:18:in `<main>'
(See full trace by running task with --trace)

```

Looking at the code [lib/tasks/assets.rake](https://github.com/discourse/discourse/blob/v2.8.8/lib/tasks/assets.rake) (v2.8.8), looks like all of the `end` and `}` are properly placed. As a non Ruby expert, I could guess that perhaps one of the variable values is breaking the closures.

What could have possibly gone wrong here ?

Kind regards,

---

<div class="post-metadata">

### Author: ![SoothSinger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/soothsinger/32/273050_2.png) [@SoothSinger](https://meta.discourse.org/u/SoothSinger)
#### Post date: [September 15, 2022, 11:11pm UTC](https://meta.discourse.org/t/missing-theme-fields-and-rake-db-migrate-syntaxerror-failure/238187/2 "2022-09-15T23:11:22Z")

</div>

Hi everyone!

Still wondering if anyone has any suggestions/ideas for this issue.

Thank you  
Kind regards,
