Missing 'theme_fields' and rake db:migrate SyntaxError failure

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 :

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; 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:

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 (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,

Hi everyone!

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

Thank you
Kind regards,