Deleting multiple hosts on new hosts page returns error 500

Problem: On the new hosts page, selecting multiple hosts, clicking on the 3 dots and select “Delete”, return an error 500.

Afer refreshing the page, the hosts are gone, so deletion actually works. This looks very similar to 3.16 Hosts Page - Deletion works but displays error message some versions ago.

Expected outcome: No error is displayed

Foreman and Proxy versions: Foreman 5.0.0 + Smart Proxy 5.0.0

Foreman and Proxy plugin versions: puppetdb_foreman 6.0.2, foreman_puppet 10.1.3

Distribution and version: AlmaLinux 9.8

Other relevant data:

This is the backtrace in the production.log, before the backtrace is additional information about the deleted hosts. If necessary, I can also provide that, but need to remove IPs etc. first.

2026-10-05T08:13:10 [I|app|335f6463] Submitted deactivate_node job to PuppetDB with UUID: 311f2fcd-74d0-406c-af94-9b60e81130c9
2026-10-05T08:13:10 [I|app|335f6463] Processed 1 tasks from queue 'Host::Managed Main', completed 4/4
2026-10-05T08:13:10 [W|app|335f6463] Action failed
2026-10-05T08:13:10 [I|app|335f6463] Backtrace for 'Action failed' error (RuntimeError): Couldn't find resource
 335f6463 | /usr/share/foreman/app/controllers/api/base_controller.rb:64:in `get_resource'
 335f6463 | /usr/share/foreman/app/controllers/api/base_controller.rb:175:in `process_success'
 335f6463 | /usr/share/foreman/app/controllers/api/base_controller.rb:181:in `process_response'
 335f6463 | /usr/share/foreman/app/controllers/api/v2/hosts_bulk_actions_controller.rb:26:in `bulk_destroy'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/abstract_controller/base.rb:215:in `process_action'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal/rendering.rb:165:in `process_action'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/abstract_controller/callbacks.rb:234:in `block in process_action'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 335f6463 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
 335f6463 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
 335f6463 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
 335f6463 | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in `around'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
 335f6463 | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in `around'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:138:in `run_callbacks'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/abstract_controller/callbacks.rb:233:in `process_action'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal/rescue.rb:23:in `process_action'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/notifications.rb:206:in `block in instrument'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/notifications.rb:206:in `instrument'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal/instrumentation.rb:66:in `process_action'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
 335f6463 | /usr/share/gems/gems/activerecord-7.0.10/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/abstract_controller/base.rb:151:in `process'
 335f6463 | /usr/share/gems/gems/actionview-7.0.10/lib/action_view/rendering.rb:39:in `process'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal.rb:188:in `dispatch'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_controller/metal.rb:251:in `dispatch'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/routing/route_set.rb:32:in `serve'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/routing/mapper.rb:48:in `serve'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/journey/router.rb:32:in `each'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/journey/router.rb:32:in `serve'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/routing/route_set.rb:852:in `call'
 335f6463 | /usr/share/gems/gems/apipie-dsl-2.6.3/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 335f6463 | /usr/share/gems/gems/apipie-rails-1.5.1/lib/apipie/static_dispatcher.rb:72:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/static.rb:23:in `call'
 335f6463 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 335f6463 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 335f6463 | /usr/share/gems/gems/apipie-rails-1.5.1/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/tempfile_reaper.rb:15:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/etag.rb:27:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/conditional_get.rb:40:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/head.rb:12:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/http/content_security_policy.rb:39:in `call'
 335f6463 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/session/abstract/id.rb:266:in `context'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/session/abstract/id.rb:260:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/cookies.rb:704:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/callbacks.rb:99:in `run_callbacks'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
 335f6463 | /usr/share/gems/gems/railties-7.0.10/lib/rails/rack/logger.rb:40:in `call_app'
 335f6463 | /usr/share/gems/gems/railties-7.0.10/lib/rails/rack/logger.rb:27:in `call'
 335f6463 | /usr/share/gems/gems/sprockets-rails-3.5.2/lib/sprockets/rails/quiet_assets.rb:17:in `call'
 335f6463 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/method_override.rb:24:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/runtime.rb:22:in `call'
 335f6463 | /usr/share/gems/gems/activesupport-7.0.10/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/executor.rb:14:in `call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/sendfile.rb:127:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 335f6463 | /usr/share/gems/gems/actionpack-7.0.10/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
 335f6463 | /usr/share/gems/gems/secure_headers-7.3.0/lib/secure_headers/middleware.rb:11:in `call'
 335f6463 | /usr/share/gems/gems/railties-7.0.10/lib/rails/engine.rb:531:in `call'
 335f6463 | /usr/share/gems/gems/railties-7.0.10/lib/rails/railtie.rb:226:in `public_send'
 335f6463 | /usr/share/gems/gems/railties-7.0.10/lib/rails/railtie.rb:226:in `method_missing'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/urlmap.rb:74:in `block in call'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/urlmap.rb:58:in `each'
 335f6463 | /usr/share/gems/gems/rack-2.2.23/lib/rack/urlmap.rb:58:in `call'
 335f6463 | /usr/share/gems/gems/puma-6.6.1/lib/puma/configuration.rb:279:in `call'
 335f6463 | /usr/share/gems/gems/puma-6.6.1/lib/puma/request.rb:99:in `block in handle_request'
 335f6463 | /usr/share/gems/gems/puma-6.6.1/lib/puma/thread_pool.rb:390:in `with_force_shutdown'
 335f6463 | /usr/share/gems/gems/puma-6.6.1/lib/puma/request.rb:98:in `handle_request'
 335f6463 | /usr/share/gems/gems/puma-6.6.1/lib/puma/server.rb:472:in `process_client'
 335f6463 | /usr/share/gems/gems/puma-6.6.1/lib/puma/server.rb:254:in `block in run'
 335f6463 | /usr/share/gems/gems/puma-6.6.1/lib/puma/thread_pool.rb:167:in `block in spawn_thread'
 335f6463 | /usr/share/gems/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2026-10-05T08:13:10 [I|app|335f6463]   Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (Duration: 0.5ms | Allocations: 83)
2026-10-05T08:13:10 [I|app|335f6463]   Rendered layout api/v2/layouts/error_layout.json.erb (Duration: 0.7ms | Allocations: 155)
2026-10-05T08:13:10 [I|app|335f6463] Completed 500 Internal Server Error in 8177ms (Views: 1.5ms | ActiveRecord: 5867.8ms | Allocations: 737489)

I can confirm that this issue is still present in Foreman 5.0.1 on Ubuntu 24.04.

Bulk deletion successfully removes the selected hosts, including deactivation in PuppetDB, but the API returns HTTP 500.

The error is identical:

RuntimeError: Couldn't find resource
api/base_controller.rb:64:in \`get_resource'
api/base_controller.rb:175:in \`process_success'
api/base_controller.rb:181:in \`process_response'
api/v2/hosts_bulk_actions_controller.rb:26:in \`bulk_destroy

Individual host deletion works correctly.

Looking at the controller, bulk_destroy calls process_response @hosts.destroy_all without supplying an explicit response object, which appears to cause process_success to call get_resource.

Could this be tracked as an upstream bug?