{"record":{"id":"3545e64f8153eb18","repo":"theforeman/foreman","slug":"duplicated-inputs-detected-duplicated-inputs","errorCode":null,"errorMessage":"Duplicated inputs detected: %{duplicated_inputs}","messagePattern":"Duplicated inputs detected: %(.+?)","errorType":"exception","errorClass":"Foreman::Exception","httpStatus":null,"severity":"error","filePath":"app/models/template.rb","lineNumber":187,"sourceCode":"  def render(renderer: Foreman::Renderer, host: nil, params: {}, variables: {}, mode: Foreman::Renderer::REAL_MODE, template_input_values: {}, source_klass: nil)\n    source = Foreman::Renderer.get_source(template: self, host: host, klass: source_klass)\n    scope = Foreman::Renderer.get_scope(host: host, params: params, variables: variables, mode: mode, template: self, source: source, template_input_values: template_input_values)\n\n    renderer.render(source, scope)\n  end\n\n  def dup\n    dup = super\n    template_inputs.each do |input|\n      dup.template_inputs.build input.attributes.except('template_id', 'id', 'created_at', 'updated_at')\n    end\n    dup\n  end\n\n  def validate_unique_inputs!\n    duplicated_inputs = template_inputs.group_by(&:name).values.select { |values| values.size > 1 }.map(&:first)\n    unless duplicated_inputs.empty?\n      raise Foreman::Exception.new(N_('Duplicated inputs detected: %{duplicated_inputs}'), :duplicated_inputs => duplicated_inputs.map(&:name))\n    end\n  end\n\n  def sync_inputs(inputs)\n    inputs ||= []\n    # Build a hash where keys are input names\n    inputs = inputs.inject({}) { |h, input| h.update(input['name'] => input) }\n\n    # Sync existing inputs\n    template_inputs.each do |existing_input|\n      if inputs.include?(existing_input.name)\n        existing_input.assign_attributes(inputs.delete(existing_input.name))\n      else\n        existing_input.mark_for_destruction\n      end\n    end\n\n    # Create new inputs","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/models/template.rb#L169-L205","documentation":"Error \"Duplicated inputs detected: %{duplicated_inputs}\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/models/template.rb:187 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"}