Couldn't find User with 'id'=

Problem:
Cant edit hosts.

Expected outcome:
Cant edit hosts.

Foreman and Proxy versions:
See below.

Foreman and Proxy plugin versions:
See below.

Distribution and version:
Alma 8

Other relevant data:
Having a strange issue when attempting to edit hosts.
User 15 does not exist on the system. When any user attempts to edit a host, it spits out the following error, below.
This is preventing us from pretty much doing anything with hosts in foreman.

Foreman version: 3.10.0
Plugins:
 - foreman-tasks 9.1.1
 - foreman_default_hostgroup 7.0.0
 - foreman_kubevirt 0.1.9
 - foreman_puppet 6.2.0
 - foreman_remote_execution 13.0.0
 - foreman_salt 16.0.2
 - foreman_statistics 2.1.0
 - foreman_templates 9.4.0
 - foreman_vault 2.0.0

2024-10-02T13:42:06 [I|app|8724b8fa] Started GET "/hosts/10-234-68-110.cloudad.ssncad.global/edit" for 10.222.218.3 at 2024-10-02 13:42:06 +0000
2024-10-02T13:42:06 [I|app|8724b8fa] Processing by HostsController#edit as HTML
2024-10-02T13:42:06 [I|app|8724b8fa]   Parameters: {"id"=>"10-234-68-110.cloudad.ssncad.global"}
2024-10-02T13:42:06 [I|app|8724b8fa] Deface: [WARNING] No :original defined for 'add_execution_interface_js', you should change its definition to include:
 8724b8fa |  :original => '9a7f73e0d2fd3f998c3a832df9e7aadcab86d4ad'
2024-10-02T13:42:06 [I|app|8724b8fa] Deface: [WARNING] No :original defined for 'add_salt_environment_to_host', you should change its definition to include:
 8724b8fa |  :original => '9a7f73e0d2fd3f998c3a832df9e7aadcab86d4ad'
2024-10-02T13:42:06 [I|app|8724b8fa] Deface: [WARNING] No :original defined for 'add_salt_modules_tab_to_host', you should change its definition to include:
 8724b8fa |  :original => '8c63c5282ee199068bfd65475e13066ee981089a'
2024-10-02T13:42:06 [I|app|8724b8fa] Deface: [WARNING] No :original defined for 'add_salt_modules_tab_pane_to_host', you should change its definition to include:
 8724b8fa |  :original => '9d04c62d38ed10a0b1630362fd26778837479599'
2024-10-02T13:42:06 [I|app|8724b8fa] Deface: [WARNING] No :original defined for 'add_salt_proxy_to_host', you should change its definition to include:
 8724b8fa |  :original => '9d04c62d38ed10a0b1630362fd26778837479599'
2024-10-02T13:42:06 [I|app|8724b8fa] Deface: [WARNING] No :original defined for 'add_execution_interface', you should change its definition to include:
 8724b8fa |  :original => 'dbe1da973bfb251a74b994e7ae11bc8d11502c97'
2024-10-02T13:42:07 [I|app|8724b8fa]   Rendered hosts/edit.html.erb within layouts/application (Duration: 502.0ms | Allocations: 123735)
2024-10-02T13:42:07 [I|app|8724b8fa]   Rendered layout layouts/application.html.erb (Duration: 502.3ms | Allocations: 123800)
2024-10-02T13:42:07 [W|app|8724b8fa] Couldn't find User with 'id'=15 [WHERE (users.id IN (21,22,11,12,10,2,13,21,5,1,22,3,14,7,5))]
2024-10-02T13:42:07 [I|app|8724b8fa] Backtrace for 'Couldn't find User with 'id'=15 [WHERE (users.id IN (21,22,11,12,10,2,13,21,5,1,22,3,14,7,5))]' error (ActionView::Template::Error): Couldn't find User with 'id'=15 [WHERE (users.id IN (21,22,11,12,10,2,13,21,5,1,22,3,14,7,5))]
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/relation/finder_methods.rb:357:in `raise_record_not_found_exception!'
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/relation/finder_methods.rb:476:in `find_one'
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/relation/finder_methods.rb:458:in `find_with_ids'
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/relation/finder_methods.rb:69:in `find'
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/querying.rb:22:in `find'
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/core.rb:340:in `find'
 8724b8fa | /usr/share/foreman/app/services/owner_classifier.rb:12:in `classify_owner'
 8724b8fa | /usr/share/foreman/app/models/concerns/hostext/ownership.rb:47:in `owner_suggestion'
 8724b8fa | /usr/share/foreman/app/views/hosts/_form.html.erb:174:in `block (2 levels) in _app_views_hosts__form_html_erb__3779544740553400681_98760'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/helpers/form_helper.rb:450:in `form_for'
 8724b8fa | /usr/share/foreman/app/helpers/form_helper.rb:286:in `form_for'
 8724b8fa | /usr/share/foreman/app/views/hosts/_form.html.erb:7:in `block in _app_views_hosts__form_html_erb__3779544740553400681_98760'
 8724b8fa | /usr/share/foreman/app/models/taxonomy.rb:80:in `block (2 levels) in as_taxonomy'
 8724b8fa | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:195:in `as_location'
 8724b8fa | /usr/share/foreman/app/models/taxonomy.rb:79:in `block in as_taxonomy'
 8724b8fa | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:154:in `as_org'
 8724b8fa | /usr/share/foreman/app/models/taxonomy.rb:78:in `as_taxonomy'
 8724b8fa | /usr/share/foreman/app/views/hosts/_form.html.erb:6:in `_app_views_hosts__form_html_erb__3779544740553400681_98760'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/base.rb:247:in `public_send'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/base.rb:247:in `_run'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/template.rb:154:in `block in render'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:205:in `instrument'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/template.rb:345:in `instrument_render_template'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/template.rb:152:in `render'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/partial_renderer.rb:285:in `block in render_partial_template'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `block in instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `instrument'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/partial_renderer.rb:280:in `render_partial_template'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/partial_renderer.rb:271:in `render'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/renderer.rb:81:in `render_partial_to_object'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/renderer.rb:27:in `render_to_object'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/renderer.rb:22:in `render'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/helpers/rendering_helper.rb:38:in `block in render'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/base.rb:273:in `in_rendering_context'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/helpers/rendering_helper.rb:34:in `render'
 8724b8fa | /usr/share/foreman/app/views/hosts/edit.html.erb:13:in `_app_views_hosts_edit_html_erb__2955036275264223586_98740'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/base.rb:247:in `public_send'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/base.rb:247:in `_run'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/template.rb:154:in `block in render'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:205:in `instrument'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/template.rb:345:in `instrument_render_template'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/template.rb:152:in `render'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/template_renderer.rb:61:in `block (2 levels) in render_template'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `block in instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `instrument'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/template_renderer.rb:56:in `block in render_template'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/template_renderer.rb:71:in `block in render_with_layout'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `block in instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `instrument'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/template_renderer.rb:70:in `render_with_layout'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/template_renderer.rb:55:in `render_template'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/template_renderer.rb:11:in `render'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/rendering.rb:117:in `block in _render_template'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/base.rb:273:in `in_rendering_context'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/rendering.rb:116:in `_render_template'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/streaming.rb:218:in `_render_template'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/rendering.rb:103:in `render_to_body'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/abstract_controller/rendering.rb:25:in `render'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/rendering.rb:36:in `render'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
 8724b8fa | /usr/share/ruby/benchmark.rb:308:in `realtime'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/core_ext/benchmark.rb:14:in `ms'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/instrumentation.rb:46:in `block in render'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/instrumentation.rb:86:in `cleanup_view_runtime'
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/instrumentation.rb:45:in `render'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/implicit_render.rb:35:in `default_render'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `block in send_action'
 8724b8fa | <internal:kernel>:90:in `tap'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/abstract_controller/base.rb:228:in `process_action'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/rendering.rb:30:in `process_action'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 8724b8fa | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 8724b8fa | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 8724b8fa | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 8724b8fa | /usr/share/gems/gems/audited-5.4.3/lib/audited/sweeper.rb:16:in `around'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 8724b8fa | /usr/share/gems/gems/audited-5.4.3/lib/audited/sweeper.rb:16:in `around'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:137:in `run_callbacks'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/abstract_controller/callbacks.rb:41:in `process_action'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/rescue.rb:22:in `process_action'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `block in instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/notifications.rb:203:in `instrument'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 8724b8fa | /usr/share/gems/gems/activerecord-6.1.7.7/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/abstract_controller/base.rb:165:in `process'
 8724b8fa | /usr/share/gems/gems/actionview-6.1.7.7/lib/action_view/rendering.rb:39:in `process'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal.rb:190:in `dispatch'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_controller/metal.rb:254:in `dispatch'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/journey/router.rb:32:in `each'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/journey/router.rb:32:in `serve'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/routing/route_set.rb:842:in `call'
 8724b8fa | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 8724b8fa | /usr/share/gems/gems/apipie-rails-1.3.0/lib/apipie/static_dispatcher.rb:74:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/static.rb:24:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/static.rb:24:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/static.rb:24:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/static.rb:24:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/static.rb:24:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/static.rb:24:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/static.rb:24:in `call'
 8724b8fa | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 8724b8fa | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 8724b8fa | /usr/share/gems/gems/apipie-rails-1.3.0/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/conditional_get.rb:27:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 8724b8fa | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/callbacks.rb:98:in `run_callbacks'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 8724b8fa | /usr/share/gems/gems/railties-6.1.7.7/lib/rails/rack/logger.rb:37:in `call_app'
 8724b8fa | /usr/share/gems/gems/railties-6.1.7.7/lib/rails/rack/logger.rb:28:in `call'
 8724b8fa | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 8724b8fa | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 8724b8fa | /usr/share/gems/gems/request_store-1.6.0/lib/request_store/middleware.rb:19:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
 8724b8fa | /usr/share/gems/gems/activesupport-6.1.7.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/executor.rb:14:in `call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 8724b8fa | /usr/share/gems/gems/actionpack-6.1.7.7/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 8724b8fa | /usr/share/gems/gems/secure_headers-6.5.0/lib/secure_headers/middleware.rb:11:in `call'
 8724b8fa | /usr/share/gems/gems/railties-6.1.7.7/lib/rails/engine.rb:539:in `call'
 8724b8fa | /usr/share/gems/gems/railties-6.1.7.7/lib/rails/railtie.rb:207:in `public_send'
 8724b8fa | /usr/share/gems/gems/railties-6.1.7.7/lib/rails/railtie.rb:207:in `method_missing'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `each'
 8724b8fa | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `call'
 8724b8fa | /usr/share/gems/gems/puma-6.4.2/lib/puma/configuration.rb:272:in `call'
 8724b8fa | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:100:in `block in handle_request'
 8724b8fa | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
 8724b8fa | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:99:in `handle_request'
 8724b8fa | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:464:in `process_client'
 8724b8fa | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:245:in `block in run'
 8724b8fa | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
 8724b8fa | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2024-10-02T13:42:07 [I|app|8724b8fa]   Rendered common/500.html.erb within layouts/application (Duration: 2.3ms | Allocations: 1361)
2024-10-02T13:42:07 [I|app|8724b8fa]   Rendered layouts/base.html.erb (Duration: 3.0ms | Allocations: 1875)
2024-10-02T13:42:07 [I|app|8724b8fa]   Rendered layout layouts/application.html.erb (Duration: 6.0ms | Allocations: 3511)
2024-10-02T13:42:07 [I|app|8724b8fa] Completed 500 Internal Server Error in 559ms (Views: 7.0ms | ActiveRecord: 33.8ms | Allocations: 135444)

And by any user, I mean even full admins.

More info:

[root@10-222-206-152 jsparrow]# foreman-rake console
Loading production environment (Rails 6.1.7.7)
irb(main):001:0> user = User.find_by(id: 15)
=> nil
irb(main):002:0> hosts = Host.where(owner_id: 15)
=> []
irb(main):003:0> hosts.each { |host| puts "Host ID: #{host.id}, Name: #{host.name}" }
=> []

No user 15:

foreman=# SELECT id, login FROM users ORDER BY id;
 id |         login
----+-----------------------
  1 | foreman_admin
  2 | foreman_console_admin
  3 | foreman_api_admin
  5 | jsparrow
  6 | dt235813
  7 | foreman_api_svc
  8 | drapench
  9 | foreman-salt-svc
 10 | dt79201
 11 | dt231399
 12 | bpang
 13 | benoh
 14 | dt231250
 16 | chaas
 17 | apapinea
 18 | kcrafford
 19 | dt64442
 21 | dt236592
 22 | saltforeman
(19 rows)

and no hosts owned by 15:

foreman=# SELECT id, name FROM hosts WHERE owner_id = 15;
 id | name
----+------
(0 rows)

Well bless the use of chatGPT o1-preview for helping me fix it. Took about 2 hours:

Find an admin user, get their id and set it as a user var:

user = User.find_by(id: 22)

Use the Setting interface to set the value

irb(main):064:0> Setting[:host_owner] = "#{user.id}-Users"

Verify all settings are set to the new id:

irb(main):068:1* Setting.all.each do |setting|
irb(main):069:1*   value = setting.read_attribute(:value).to_s
irb(main):070:2*   if value.include?('15')
irb(main):071:2*     puts "Setting '#{setting.name}' references user ID 15."
irb(main):072:2*     # Optionally update the setting
irb(main):073:2*     # For example, if it's 'some_setting', you can update it accordingly
irb(main):074:1*   end
irb(main):075:0> end

Clear cache and restart foreman:

sudo foreman-rake tmp:cache:clear
sudo systemctl restart foreman

more sets:

irb(main):012:0> admin_user = User.find_by(id: 22)
=>
#  puts "Admin User ID: #{admin_user.id}, Login: #{admin_user.login}"
Admin User ID: 22, Login: saltforeman
=> nil
irb(main):014:1* if admin_user
irb(main):015:1*   puts "Admin User ID: #{admin_user.id}, Login: #{admin_user.login}"
irb(main):016:1*
irb(main):017:1*   # Update the 'host_owner' setting
irb(main):018:1*   host_owner_setting = Setting.find_by(name: 'host_owner')
irb(main):019:1*
irb(main):020:2*   if host_owner_setting
irb(main):021:2*     # Update the setting to use the valid user ID
irb(main):022:2*     new_value = "22"
irb(main):023:2*     host_owner_setting.update(value: new_value)
irb(main):024:2*     puts "Updated 'host_owner' setting to reference user ID #{admin_user.id}."
irb(main):025:2*   else
irb(main):026:2*     puts "'host_owner' setting not found."
irb(main):027:1*   end
irb(main):028:1* else
irb(main):029:1*   put