{"record":{"id":"8ed5ebdbc0daaabf","repo":"theforeman/foreman","slug":"no-templates-found","errorCode":null,"errorMessage":"No templates found","messagePattern":"No templates found","errorType":"exception","errorClass":"Foreman::Exception","httpStatus":500,"severity":"error","filePath":"app/controllers/hosts_controller.rb","lineNumber":878,"sourceCode":"      if proxy\n        success _('The %{proxy_type} proxy of the selected hosts was set to %{proxy_name}') % {:proxy_name => proxy.name, :proxy_type => proxy_type}\n      else\n        success _('The %{proxy_type} proxy of the selected hosts was cleared') % {:proxy_type => proxy_type}\n      end\n    else\n      error n_(\"The %{proxy_type} proxy could not be set for host: %{host_names}.\",\n        \"The %{proxy_type} puppet ca proxy could not be set for hosts: %{host_names}\",\n        failed_hosts.count) % {:proxy_type => proxy_type, :host_names => failed_hosts.map { |h, err| \"#{h} (#{err})\" }.to_sentence}\n    end\n    redirect_back_or_to helpers.current_hosts_path\n  end\n\n  def find_templates\n    find_resource\n    @templates = TemplateKind.order(:name).map do |kind|\n      @host.provisioning_template(:kind => kind.name)\n    end.compact\n    raise Foreman::Exception.new(N_(\"No templates found\")) if @templates.empty?\n  end\n\n  def host_attributes_for_templates(host)\n    # This method wants to only get the attributes applicable to the current\n    # kind of host. For example 'is_owned_by', even if it's in host_params,\n    # should be ignored by Host::Discovered or any other Host class that does\n    # not have that attribute\n    host_attributes = host.class.attribute_names.dup\n    if host_params[\"compute_attributes\"].present?\n      host_attributes << 'compute_attributes'\n    end\n    host_params.select do |k, v|\n      host_attributes.include?(k) && !k.end_with?('_ids')\n    end.except(:host_parameters_attributes)\n  end\n\n  def csv_columns\n    csv_pagelets.map { |pagelet| pagelet.opts[:export_data] || pagelet.opts[:export_key] || pagelet.opts[:key] }.flatten","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/controllers/hosts_controller.rb#L860-L896","documentation":"Error \"No templates found\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/controllers/hosts_controller.rb:878 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}