theforeman/foreman · error

Unable to update template #{t.name}: #{format_errors t}

Error message

Unable to update template #{t.name}: #{format_errors t}

What it means

Error "Unable to update template #{t.name}: #{format_errors t}" thrown in theforeman/foreman.

Source

Thrown at lib/seed_helper.rb:132

      rescue NameError
        logger.info("Unknown model #{metadata['model']} in template #{name}, skipping import.")
        return
      end

      # Skip templates with custom changes
      return if audit_modified?(model, name)
      # Skip templates that don't match requirements
      return unless test_template_requirements(name, requirements)

      t = model.import_without_save(name, contents, { :default => true, :lock => true, :associate => 'new' })
      t.vendor = vendor

      if !t.persisted?
        t.organizations = Organization.unscoped.all if t.respond_to?(:organizations=)
        t.locations = Location.unscoped.all if t.respond_to?(:locations=)
        raise "Unable to create template #{t.name}: #{format_errors t}" unless t.valid?
      else
        raise "Unable to update template #{t.name}: #{format_errors t}" unless t.ignore_locking { t.valid? }
      end

      t.ignore_locking { t.save! }
      t
    end

    def import_templates(template_paths, vendor = 'Foreman')
      template_paths.each do |path|
        import_raw_template(File.read(path), vendor)
      rescue RuntimeError => e
        Foreman::Logging.exception("Error in seeding the template #{path.inspect} metadata #{e.message}", e)
        raise e
      end
    end

    def partition_tables_templates
      Dir["#{Rails.root}/app/views/unattended/partition_tables_templates/*.erb"]
    end

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at lib/seed_helper.rb:132 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/52dd36d40c571a81. Report an issue: GitHub.