diff --git a/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb b/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb
index 60d95fe0ea81ee4a4834e7ce6ea746726b4fabbe..d9be12b0e780089fa975d54f2e7770bf2dce35cc 100644
--- a/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb
+++ b/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb
@@ -15,6 +15,8 @@ module ForemanUuidBoot
       return unless (uuid = query_params['uuid'])
 
       fact_name_id = FactName.where(name: 'uuid').map(&:id)
+      return unless fact_name_id.any?
+
       query = { fact_values: { fact_name_id: fact_name_id, value: uuid } }
       hosts = Host.joins(:fact_values).where(query).order(:created_at)