Foreman-rake config throws error

Problem:
I’m trying to change the ‘trusted_hosts’ config. When I run the following command, I receive an error:

:~# foreman-rake config -k 'trusted_hosts' -v '["server.example.com"]'
NoMethodError: undefined method `all?' for "[\"server.example.com\"]":String

If I create the entry manually via the web browser in the settings page and then delete it, the foreman-rake command now works as expected.

I tested on nightly, it works as it expected.

Expected outcome:
The foreman-rake config should work the first time

Foreman and Proxy versions:
Foreman 3.2.1 and 3.3

Foreman and Proxy plugin versions:

Distribution and version:
RockyLinux 8

Other relevant data:

I’ve built my foreman server with the foreman puppet module available on the forge
I’ve tried to change the entry with foreman_config_entry {‘trusted_hosts’: …} but the error also appears when I try to run it manually (foreman-rake config).

The full stack trace:

:~# foreman-rake config -k 'trusted_hosts' -v '["server.example.com"]'
NoMethodError: undefined method `all?' for "[\"server.example.com\"]":String
/usr/share/foreman/app/validators/array_hostnames_ips_validator.rb:4:in `validate_each'
/usr/share/gems/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:152:in `block in validate'
/usr/share/gems/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `each'
/usr/share/gems/gems/activemodel-6.0.3.7/lib/active_model/validator.rb:149:in `validate'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:428:in `block in make_lambda'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:181:in `block (2 levels) in halting_and_conditional'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:605:in `block (2 levels) in default_terminator'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `catch'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:604:in `block in default_terminator'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:182:in `block in halting_and_conditional'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `block in invoke_before'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `each'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:513:in `invoke_before'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:134:in `run_callbacks'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validate_callbacks'
/usr/share/gems/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:406:in `run_validations!'
/usr/share/gems/gems/activemodel-6.0.3.7/lib/active_model/validations/callbacks.rb:117:in `block in run_validations!'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:135:in `run_callbacks'
/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:825:in `_run_validation_callbacks'
/usr/share/gems/gems/activemodel-6.0.3.7/lib/active_model/validations/callbacks.rb:117:in `run_validations!'
/usr/share/gems/gems/activemodel-6.0.3.7/lib/active_model/validations.rb:337:in `valid?'
/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/validations.rb:68:in `valid?'
/usr/share/foreman/lib/tasks/config.rake:148:in `validate_and_save'
/usr/share/foreman/lib/tasks/config.rake:111:in `block in run_key_values'
/usr/share/foreman/lib/tasks/config.rake:100:in `each'
/usr/share/foreman/lib/tasks/config.rake:100:in `run_key_values'
/usr/share/foreman/lib/tasks/config.rake:77:in `run'
/usr/share/foreman/lib/tasks/config.rake:167:in `block in <top (required)>'
/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => config