Can not register a client any more (undefined method `[]' for nil:NilClass (HTTP error code 500: Internal Server Error)

Problem:
can not register a client any more

subscription-manager register --name=“dedavlxtest1” --org=‘xxx’ --activationkey=“SLES_15.6_SAP_DEV”
resultst in: (undefined method `’ for nil:NilClass (HTTP error code 500: Internal Server Error)

Expected outcome:

successfully registered system

Foreman and Proxy versions:
3.16

Foreman and Proxy plugin versions:

katello 4.18

Distribution and version:

Other relevant data:

Started POST “/rhsm/consumers?owner=XXX&activation_keys=SLES_15.6_SAP_DEV” for 192.168.188.242 at 2025-11-03 11:19:52 +0100
2025-11-03T11:19:52 [I|app|783d4662] Processing by Katello::Api::Rhsm::CandlepinProxiesController#consumer_activate as JSON
2025-11-03T11:19:52 [I|app|783d4662] Parameters: {“type”=>“system”, “name”=>“dedavlxtest1”, “facts”=>“[FILTERED]”, “contentTags”=>, “role”=>“”, “addOns”=>, “usage”=>“”, “serviceLevel”=>“”, “owner”=>“xxx”, “activation_keys”=>“SLES_15.6_SAP_DEV”}
2025-11-03T11:19:52 [E|kat|783d4662] NoMethodError: undefined method []' for nil:NilClass 783d4662 | /usr/share/foreman/app/models/concerns/hostext/operating_system.rb:41:in template_kinds’
783d4662 | /usr/share/foreman/app/models/concerns/orchestration/templates.rb:43:in kind' 783d4662 | /usr/share/foreman/app/models/concerns/orchestration/templates.rb:35:in template’
783d4662 | /usr/share/foreman/app/models/concerns/orchestration/templates.rb:12:in queue_render_checks' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:400:in block in make_lambda’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:247:in block in halting' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:599:in block in invoke_after’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:599:in each' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:599:in invoke_after’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:108:in run_callbacks' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:929:in _run_validation_callbacks’
783d4662 | /usr/share/gems/gems/activemodel-7.0.8.7/lib/active_model/validations/callbacks.rb:115:in run_validations!' 783d4662 | /usr/share/gems/gems/activemodel-7.0.8.7/lib/active_model/validations.rb:337:in valid?’
783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/validations.rb:68:in valid?' 783d4662 | /usr/share/foreman/app/models/concerns/orchestration.rb:83:in valid?’
783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/validations.rb:84:in perform_validations' 783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/validations.rb:53:in save!’
783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/transactions.rb:302:in block in save!' 783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/transactions.rb:354:in block in with_transaction_returning_status’
783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/abstract/transaction.rb:319:in block in within_new_transaction' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize' 783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/abstract/transaction.rb:317:in within_new_transaction’
783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in transaction' 783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/transactions.rb:350:in with_transaction_returning_status’
783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/transactions.rb:302:in save!' 783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/suppressor.rb:54:in save!’
783d4662 | /usr/share/gems/gems/katello-4.18.1/app/services/katello/registration_manager.rb:161:in register_host' 783d4662 | /usr/share/gems/gems/katello-4.18.1/app/services/katello/registration_manager.rb:36:in process_registration’
783d4662 | /usr/share/gems/gems/katello-4.18.1/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb:242:in consumer_activate' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/basic_implicit_render.rb:6:in send_action’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/base.rb:215:in process_action' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/rendering.rb:165:in process_action’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/callbacks.rb:234:in block in process_action' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:118:in block in run_callbacks’
783d4662 | /usr/share/gems/gems/katello-4.18.1/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb:37:in repackage_message' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in block in run_callbacks’
783d4662 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in set_timezone' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in block in run_callbacks’
783d4662 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in clear_thread' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in block in run_callbacks’
783d4662 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in set_topbar_sweeper_controller' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in block in run_callbacks’
783d4662 | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in around' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in block in run_callbacks’
783d4662 | /usr/share/gems/gems/audited-5.8.0/lib/audited/sweeper.rb:16:in around' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:127:in block in run_callbacks’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:138:in run_callbacks' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/callbacks.rb:233:in process_action’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/rescue.rb:23:in process_action' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/instrumentation.rb:67:in block in process_action’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in block in instrument' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications/instrumenter.rb:24:in instrument’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in instrument' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/instrumentation.rb:66:in process_action’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal/params_wrapper.rb:259:in process_action' 783d4662 | /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/railties/controller_runtime.rb:27:in process_action’
783d4662 | /usr/share/gems/gems/katello-4.18.1/app/controllers/katello/concerns/api/api_controller.rb:46:in process_action' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/abstract_controller/base.rb:151:in process’
783d4662 | /usr/share/gems/gems/actionview-7.0.8.7/lib/action_view/rendering.rb:39:in process' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal.rb:188:in dispatch’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_controller/metal.rb:251:in dispatch' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:49:in dispatch’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:32:in serve' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/mapper.rb:18:in block in class:Constraints
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/mapper.rb:48:in serve' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:50:in block in serve’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in each' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in serve’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:852:in call' 783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/engine.rb:530:in call’
783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in public_send' 783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in method_missing’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/mapper.rb:19:in block in <class:Constraints>' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/mapper.rb:48:in serve’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:50:in block in serve' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in each’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/journey/router.rb:32:in serve' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/routing/route_set.rb:852:in call’
783d4662 | /usr/share/gems/gems/katello-4.18.1/lib/katello/middleware/organization_created_enforcer.rb:18:in call' 783d4662 | /usr/share/gems/gems/katello-4.18.1/lib/katello/middleware/event_daemon.rb:10:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call’
783d4662 | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in call' 783d4662 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/static_dispatcher.rb:74:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/static.rb:23:in call’
783d4662 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in call' 783d4662 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in call’
783d4662 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/middleware/checksum_in_headers.rb:27:in call' 783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/tempfile_reaper.rb:15:in call’
783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/etag.rb:27:in call' 783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/conditional_get.rb:40:in call’
783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/head.rb:12:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/http/permissions_policy.rb:38:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/http/content_security_policy.rb:39:in call' 783d4662 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in call’
783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/session/abstract/id.rb:266:in context' 783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/session/abstract/id.rb:260:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/cookies.rb:704:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/callbacks.rb:27:in block in call’
783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/callbacks.rb:99:in run_callbacks' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/callbacks.rb:26:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/debug_exceptions.rb:28:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/show_exceptions.rb:29:in call’
783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/rack/logger.rb:40:in call_app' 783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/rack/logger.rb:27:in call’
783d4662 | /usr/share/gems/gems/sprockets-rails-3.5.2/lib/sprockets/rails/quiet_assets.rb:17:in call' 783d4662 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/remote_ip.rb:93:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/request_id.rb:26:in call’
783d4662 | /usr/share/gems/gems/katello-4.18.1/lib/katello/prevent_json_parsing.rb:12:in call' 783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/method_override.rb:24:in call’
783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/runtime.rb:22:in call' 783d4662 | /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/executor.rb:14:in call' 783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/sendfile.rb:110:in call’
783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/ssl.rb:77:in call' 783d4662 | /usr/share/gems/gems/actionpack-7.0.8.7/lib/action_dispatch/middleware/host_authorization.rb:131:in call’
783d4662 | /usr/share/gems/gems/secure_headers-7.1.0/lib/secure_headers/middleware.rb:11:in call' 783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/engine.rb:530:in call’
783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in public_send' 783d4662 | /usr/share/gems/gems/railties-7.0.8.7/lib/rails/railtie.rb:226:in method_missing’
783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/urlmap.rb:74:in block in call' 783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/urlmap.rb:58:in each’
783d4662 | /usr/share/gems/gems/rack-2.2.17/lib/rack/urlmap.rb:58:in call' 783d4662 | /usr/share/gems/gems/puma-6.6.1/lib/puma/configuration.rb:279:in call’
783d4662 | /usr/share/gems/gems/puma-6.6.1/lib/puma/request.rb:99:in block in handle_request' 783d4662 | /usr/share/gems/gems/puma-6.6.1/lib/puma/thread_pool.rb:390:in with_force_shutdown’
783d4662 | /usr/share/gems/gems/puma-6.6.1/lib/puma/request.rb:98:in handle_request' 783d4662 | /usr/share/gems/gems/puma-6.6.1/lib/puma/server.rb:472:in process_client’
783d4662 | /usr/share/gems/gems/puma-6.6.1/lib/puma/server.rb:254:in block in run' 783d4662 | /usr/share/gems/gems/puma-6.6.1/lib/puma/thread_pool.rb:167:in block in spawn_thread’
783d4662 | /usr/share/gems/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context’

Hello!

Thanks for reporting this issue and including the tracebacks, that is very helpful!

This looks like a known issue, where the host object is missing critical information (like Operating System details) during the initial registration process.

During analysis of 500 Error, the traceback shows a NoMethodError: undefined method '[]' for nil:NilClass originating in hostext/operating_system.rb.

This error occurs when the registration logic attempts to look up a required property (like OS version or architecture) from a variable that is currently nil (empty). Essentially, the server can’t fetch the required host template information because the host object is incomplete at that moment, leading to the 500 Internal Server Error.

The best way to immediately work around this issue and ensure a complete host object is created during registration is to use a Global Registration Template associated with your Activation Key

  1. Associate a Template: Go to your Activation Key (SLES_15.6_SAP_DEV in this case) and follow System registration link
  2. Ensure Completeness: Make sure that this template explicitly defines essential parameters like the target Host group or Operating System for the hosts using this key.

Hope this helps you get your clients registered!

no … it doesn’t help :frowning:

set -o pipefail && curl --silent --show-error --insecure ‘https://dedavlx206.da.doehler.com/register?activation_keys=SLES_15.6_SAP_DEV&download_utility=curl&hostgroup_id=38&location_id=4&operatingsystem_id=55&organization_id=3&update_packages=false’ --header ‘Authorization: Bearer ey…6PUxk’ | bash

Running registration

cp: cannot create regular file ‘/etc/pki/ca-trust/source/anchors’: No such file or directory
bash: line 473: update-ca-trust: command not found
subscription-manager is already installed!
** ERROR ** Failed to save log entry
SMBIOS: entry point at 0x0ff72000
undefined method `’ for nil:NilClass (HTTP error code 500: Internal Server Error)

by the way: the registration process uses commandos from redhat based os and not suse!

It’s strange that it was working fine until recently.

Further insight: the error occurs when I try to (re)register a host that was created with the values from the deployment (the systems were installed using Foreman deployment (VMware)). After deleting the system in Foreman, the host can be registered (and also re-registered). I checked the old host entries and all fields such as OS, host group, and others are actually filled in correctly. Before 3.16, it was no problem to re-register an existing host.

Sounds like you are able to (re)register host to server after removing host entry from database. Is my understanding correct?

As far as I know, if you are trying to re-register a host under different organization then it won’t allow you.

Hi,

no, organisation and all other (like os) are the same like from the deployment. nothing had changed

and I’m using the same activation key

I think this should be fixed with refs #38422 - template_kinds if compute_attributes_empty? by stejskalleos · Pull Request #10658 · theforeman/foreman · GitHub

It should be in 3.16.1.

1 Like