{"record":{"id":"f36142d12a40d3a4","repo":"theforeman/foreman","slug":"unable-to-create-template-t-name-format-erro","errorCode":null,"errorMessage":"Unable to create template #{t.name}: #{format_errors t}","messagePattern":"Unable to create template #(.+?): #(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/seed_helper.rb","lineNumber":130,"sourceCode":"      begin\n        model = metadata['model'].constantize\n      rescue NameError\n        logger.info(\"Unknown model #{metadata['model']} in template #{name}, skipping import.\")\n        return\n      end\n\n      # Skip templates with custom changes\n      return if audit_modified?(model, name)\n      # Skip templates that don't match requirements\n      return unless test_template_requirements(name, requirements)\n\n      t = model.import_without_save(name, contents, { :default => true, :lock => true, :associate => 'new' })\n      t.vendor = vendor\n\n      if !t.persisted?\n        t.organizations = Organization.unscoped.all if t.respond_to?(:organizations=)\n        t.locations = Location.unscoped.all if t.respond_to?(:locations=)\n        raise \"Unable to create template #{t.name}: #{format_errors t}\" unless t.valid?\n      else\n        raise \"Unable to update template #{t.name}: #{format_errors t}\" unless t.ignore_locking { t.valid? }\n      end\n\n      t.ignore_locking { t.save! }\n      t\n    end\n\n    def import_templates(template_paths, vendor = 'Foreman')\n      template_paths.each do |path|\n        import_raw_template(File.read(path), vendor)\n      rescue RuntimeError => e\n        Foreman::Logging.exception(\"Error in seeding the template #{path.inspect} metadata #{e.message}\", e)\n        raise e\n      end\n    end\n\n    def partition_tables_templates","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/lib/seed_helper.rb#L112-L148","documentation":"Error \"Unable to create template #{t.name}: #{format_errors t}\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at lib/seed_helper.rb:130 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"}