Generic Error "Oops, we're sorry but something went wrong undefined method `name' for nil:NilClass"

Problem: Editing some specific hosts or hostgroups, the error page appear with that message

Expected outcome: Editing page for selected host or hostgroup

Foreman and Proxy versions: 3.9.1

Foreman and Proxy plugin versions:
Foreman version: 3.9.1
Plugins:

  • foreman-tasks 9.0.4
  • foreman_acd 0.9.4
  • foreman_ansible 13.0.3
  • foreman_bootdisk 21.2.1
  • foreman_default_hostgroup 7.0.0
  • foreman_dhcp_browser 0.0.8
  • foreman_discovery 23.0.0
  • foreman_fog_proxmox 0.15.0
  • foreman_hooks 0.3.17
  • foreman_kernel_care 2.0.0
  • foreman_kubevirt 0.1.9
  • foreman_leapp 1.1.1
  • foreman_monitoring 3.0.0
  • foreman_openscap 7.1.1
  • foreman_puppet 6.2.0
  • foreman_remote_execution 12.0.5
  • foreman_rh_cloud 9.0.53
  • foreman_setup 8.0.1
  • foreman_snapshot_management 3.0.0
  • foreman_statistics 2.1.0
  • foreman_templates 9.4.0
  • foreman_vault 1.2.0
  • foreman_virt_who_configure 0.5.19
  • foreman_webhooks 3.2.2
  • katello 4.11.1
  • puppetdb_foreman 6.0.2

Distribution and version:
RedHat Enterprise 8.9
Other relevant data:

2024-03-21T22:29:35 [I|app|3795bb66] Started GET "/hosts/smartproxy.my.cool.domain/edit" for 192.168.3.100 at 2024-03-21 22:29:35 +0100
2024-03-21T22:29:35 [I|app|3795bb66] Processing by HostsController#edit as HTML
2024-03-21T22:29:35 [I|app|3795bb66]   Parameters: {"id"=>"smartproxy.my.cool.domain"}
2024-03-21T22:29:35 [D|tax|3795bb66] Current location set to LOC
2024-03-21T22:29:35 [D|tax|3795bb66] Current organization set to ORG
2024-03-21T22:29:35 [D|app|3795bb66]   Rendering layout layouts/application.html.erb
2024-03-21T22:29:35 [D|app|3795bb66]   Rendering hosts/edit.html.erb within layouts/application
2024-03-21T22:29:35 [D|app|3795bb66] Deface: 3 overrides found for 'hosts/_form'
2024-03-21T22:29:35 [D|app|3795bb66] Deface: 'add_execution_interface_js' matched 1 times with 'div#primary'
2024-03-21T22:29:35 [I|app|3795bb66] Deface: [WARNING] No :original defined for 'add_execution_interface_js', you should change its definition to include:
 3795bb66 |  :original => '9a7f73e0d2fd3f998c3a832df9e7aadcab86d4ad'
2024-03-21T22:29:35 [D|app|3795bb66] Deface: 'ansible_roles_tab' matched 1 times with 'li.active'
2024-03-21T22:29:35 [I|app|3795bb66] Deface: [WARNING] No :original defined for 'ansible_roles_tab', you should change its definition to include:
 3795bb66 |  :original => '8c63c5282ee199068bfd65475e13066ee981089a'
2024-03-21T22:29:35 [D|app|3795bb66] Deface: 'ansible_roles_tab_content' matched 1 times with 'div.tab-pane.active'
2024-03-21T22:29:35 [I|app|3795bb66] Deface: [WARNING] No :original defined for 'ansible_roles_tab_content', you should change its definition to include:
 3795bb66 |  :original => '9a7f73e0d2fd3f998c3a832df9e7aadcab86d4ad'
2024-03-21T22:29:35 [D|app|3795bb66]   Rendered hosts/_progress.html.erb (Duration: 1.9ms | Allocations: 765)
2024-03-21T22:29:35 [D|tax|3795bb66] Current organization set to ORG
2024-03-21T22:29:35 [D|tax|3795bb66] Current location set to LOC
2024-03-21T22:29:35 [D|app|3795bb66]   Rendered /usr/share/gems/gems/katello-4.11.1/app/views/overrides/activation_keys/_host_environment_select.html.erb (Duration: 88.4ms | Allocations: 24295)
2024-03-21T22:29:35 [D|app|3795bb66]   Rendered /usr/share/gems/gems/foreman_puppet-6.2.0/app/views/hosts/foreman_puppet/_form_main_tab_fields.html.erb (Duration: 9.4ms | Allocations: 3044)
2024-03-21T22:29:35 [D|tax|3795bb66] Current location set to LOC
2024-03-21T22:29:35 [D|tax|3795bb66] Current organization set to ORG
2024-03-21T22:29:35 [D|app|3795bb66]   Rendered hosts/_form.html.erb (Duration: 241.1ms | Allocations: 74857)
2024-03-21T22:29:35 [I|app|3795bb66]   Rendered hosts/edit.html.erb within layouts/application (Duration: 263.8ms | Allocations: 87979)
2024-03-21T22:29:35 [I|app|3795bb66]   Rendered layout layouts/application.html.erb (Duration: 263.9ms | Allocations: 88071)
2024-03-21T22:29:35 [W|app|3795bb66] undefined method `name' for nil:NilClass
2024-03-21T22:29:35 [I|app|3795bb66] Backtrace for 'undefined method `name' for nil:NilClass' error (ActionView::Template::Error): undefined method `name' for nil:NilClass
 3795bb66 | /usr/share/gems/gems/foreman_ansible-13.0.3/app/helpers/foreman_ansible/ansible_roles_helper.rb:58:in `block in model_roles_attrs'
 3795bb66 | /usr/share/gems/gems/foreman_ansible-13.0.3/app/helpers/foreman_ansible/ansible_roles_helper.rb:58:in `map'
 3795bb66 | /usr/share/gems/gems/foreman_ansible-13.0.3/app/helpers/foreman_ansible/ansible_roles_helper.rb:58:in `model_roles_attrs'
 3795bb66 | /usr/share/gems/gems/foreman_ansible-13.0.3/app/helpers/foreman_ansible/ansible_roles_helper.rb:47:in `role_attributes_for_roles_switcher'
 3795bb66 | /usr/share/foreman/app/views/hosts/_form.html.erb:99:in `block (2 levels) in _3662c01435d7f9db00534ee2ec4f2d22'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/helpers/form_helper.rb:450:in `form_for'
 3795bb66 | /usr/share/foreman/app/helpers/form_helper.rb:286:in `form_for'
 3795bb66 | /usr/share/foreman/app/views/hosts/_form.html.erb:7:in `block in _3662c01435d7f9db00534ee2ec4f2d22'
 3795bb66 | /usr/share/foreman/app/models/taxonomy.rb:80:in `block (2 levels) in as_taxonomy'
 3795bb66 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:195:in `as_location'
 3795bb66 | /usr/share/foreman/app/models/taxonomy.rb:79:in `block in as_taxonomy'
 3795bb66 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:154:in `as_org'
 3795bb66 | /usr/share/foreman/app/models/taxonomy.rb:78:in `as_taxonomy'
 3795bb66 | /usr/share/foreman/app/views/hosts/_form.html.erb:6:in `_3662c01435d7f9db00534ee2ec4f2d22'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/base.rb:247:in `public_send'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/base.rb:247:in `_run'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/template.rb:154:in `block in render'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:205:in `instrument'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/template.rb:345:in `instrument_render_template'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/template.rb:152:in `render'
 3795bb66 | /usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/partial_renderer.rb:285:in `block in render_partial_template'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `block in instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `instrument'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/partial_renderer.rb:280:in `render_partial_template'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/partial_renderer.rb:271:in `render'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/renderer.rb:81:in `render_partial_to_object'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/renderer.rb:27:in `render_to_object'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/renderer.rb:22:in `render'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/helpers/rendering_helper.rb:38:in `block in render'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/base.rb:273:in `in_rendering_context'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/helpers/rendering_helper.rb:34:in `render'
 3795bb66 | /usr/share/foreman/app/views/hosts/edit.html.erb:13:in `_e330abfdc1638e93082731b6a7c4abef'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/base.rb:247:in `public_send'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/base.rb:247:in `_run'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/template.rb:154:in `block in render'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:205:in `instrument'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/template.rb:345:in `instrument_render_template'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/template.rb:152:in `render'
 3795bb66 | /usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/template_renderer.rb:61:in `block (2 levels) in render_template'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `block in instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `instrument'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/template_renderer.rb:56:in `block in render_template'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/template_renderer.rb:71:in `block in render_with_layout'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `block in instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `instrument'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/template_renderer.rb:70:in `render_with_layout'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/template_renderer.rb:55:in `render_template'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/template_renderer.rb:11:in `render'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/rendering.rb:117:in `block in _render_template'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/base.rb:273:in `in_rendering_context'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/rendering.rb:116:in `_render_template'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/streaming.rb:218:in `_render_template'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/rendering.rb:103:in `render_to_body'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/rendering.rb:25:in `render'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb:36:in `render'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
 3795bb66 | /usr/share/ruby/benchmark.rb:308:in `realtime'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/core_ext/benchmark.rb:14:in `ms'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:46:in `block in render'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:86:in `cleanup_view_runtime'
 3795bb66 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:45:in `render'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/implicit_render.rb:35:in `default_render'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `block in send_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `tap'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:228:in `process_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb:30:in `process_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 3795bb66 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3795bb66 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3795bb66 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3795bb66 | /usr/share/gems/gems/audited-5.4.2/lib/audited/sweeper.rb:16:in `around'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3795bb66 | /usr/share/gems/gems/audited-5.4.2/lib/audited/sweeper.rb:16:in `around'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:137:in `run_callbacks'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:41:in `process_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/rescue.rb:22:in `process_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `block in instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/notifications.rb:203:in `instrument'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 3795bb66 | /usr/share/gems/gems/activerecord-6.1.7.6/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:165:in `process'
 3795bb66 | /usr/share/gems/gems/actionview-6.1.7.6/lib/action_view/rendering.rb:39:in `process'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb:190:in `dispatch'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_controller/metal.rb:254:in `dispatch'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `each'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/journey/router.rb:32:in `serve'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/routing/route_set.rb:842:in `call'
 3795bb66 | /usr/share/gems/gems/katello-4.11.1/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 3795bb66 | /usr/share/gems/gems/katello-4.11.1/lib/katello/middleware/event_daemon.rb:10:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/apipie-dsl-2.6.1/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 3795bb66 | /usr/share/gems/gems/apipie-rails-1.2.3/lib/apipie/static_dispatcher.rb:68:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/static.rb:24:in `call'
 3795bb66 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 3795bb66 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 3795bb66 | /usr/share/gems/gems/apipie-rails-1.2.3/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 3795bb66 | /usr/share/gems/gems/prometheus-client-4.2.2/lib/prometheus/middleware/exporter.rb:33:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/tempfile_reaper.rb:15:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/etag.rb:27:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/conditional_get.rb:27:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/head.rb:12:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 3795bb66 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:266:in `context'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/session/abstract/id.rb:260:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:98:in `run_callbacks'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 3795bb66 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/rack/logger.rb:37:in `call_app'
 3795bb66 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/rack/logger.rb:28:in `call'
 3795bb66 | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 3795bb66 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 3795bb66 | /usr/share/gems/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 3795bb66 | /usr/share/gems/gems/katello-4.11.1/lib/katello/prevent_json_parsing.rb:12:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/method_override.rb:24:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/runtime.rb:22:in `call'
 3795bb66 | /usr/share/gems/gems/activesupport-6.1.7.6/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/executor.rb:14:in `call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/sendfile.rb:110:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 3795bb66 | /usr/share/gems/gems/actionpack-6.1.7.6/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 3795bb66 | /usr/share/gems/gems/secure_headers-6.5.0/lib/secure_headers/middleware.rb:11:in `call'
 3795bb66 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/engine.rb:539:in `call'
 3795bb66 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `public_send'
 3795bb66 | /usr/share/gems/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `method_missing'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:74:in `block in call'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in `each'
 3795bb66 | /usr/share/gems/gems/rack-2.2.8/lib/rack/urlmap.rb:58:in `call'
 3795bb66 | /usr/share/gems/gems/puma-6.4.0/lib/puma/configuration.rb:272:in `call'
 3795bb66 | /usr/share/gems/gems/puma-6.4.0/lib/puma/request.rb:100:in `block in handle_request'
 3795bb66 | /usr/share/gems/gems/puma-6.4.0/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
 3795bb66 | /usr/share/gems/gems/puma-6.4.0/lib/puma/request.rb:99:in `handle_request'
 3795bb66 | /usr/share/gems/gems/puma-6.4.0/lib/puma/server.rb:443:in `process_client'
 3795bb66 | /usr/share/gems/gems/puma-6.4.0/lib/puma/server.rb:241:in `block in run'
 3795bb66 | /usr/share/gems/gems/puma-6.4.0/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
 3795bb66 | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2024-03-21T22:29:35 [D|app|3795bb66]   Rendering layout layouts/application.html.erb
2024-03-21T22:29:35 [D|app|3795bb66]   Rendering common/500.html.erb within layouts/application
2024-03-21T22:29:35 [I|app|3795bb66]   Rendered common/500.html.erb within layouts/application (Duration: 4.9ms | Allocations: 2432)
2024-03-21T22:29:35 [D|app|3795bb66]   Rendered layouts/_application_content.html.erb (Duration: 1.0ms | Allocations: 416)
2024-03-21T22:29:35 [D|app|3795bb66]   Rendering layouts/base.html.erb
2024-03-21T22:29:35 [I|app|3795bb66]   Rendered layouts/base.html.erb (Duration: 15.5ms | Allocations: 13877)
2024-03-21T22:29:35 [I|app|3795bb66]   Rendered layout layouts/application.html.erb (Duration: 23.6ms | Allocations: 17378)
2024-03-21T22:29:35 [I|app|3795bb66] Completed 500 Internal Server Error in 360ms (Views: 25.0ms | ActiveRecord: 77.4ms | Allocations: 127156)

I am not very familiar with foreman-ansible, but looking at the code, it is trying to map the associated ansible roles from their IDs to their names and failes to find at least one of the associated roles.
These errors are mostly caused by org/loc scoping or permission issues. From what I can see, ansible roles are not scoped by org/loc, so that would leave permissions as the most likely cause imo. Does your user have full/admin permissions? If not, does the problem also occure for an admin user?

hi, thank you for your reply. my user is the admin created at the installation process. other users have been created but are not used by me.