{"record":{"id":"14aabcaca24e7d03","repo":"theforeman/foreman","slug":"could-not-read-name-from-metadata-in-template-fi","errorCode":null,"errorMessage":"Could not read name from metadata in template #{filepath}.","messagePattern":"Could not read name from metadata in template #(.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/services/foreman/render_templates_from_folder.rb","lineNumber":62,"sourceCode":"    def render_template(template)\n      source = source_klass.new(template)\n      scope = Foreman::Renderer.get_scope(host: host(template), source: source)\n      Foreman::Renderer.render(source, scope)\n    end\n\n    def templates\n      @templates ||= files.map { |filepath| load_file(filepath) }\n    end\n\n    def snippets\n      templates.select(&:snippet?)\n    end\n\n    def load_file(filepath)\n      content = File.read(filepath)\n      metadata = Template.parse_metadata(content).deep_symbolize_keys\n      name = metadata[:name]\n      raise \"Could not read name from metadata in template #{filepath}.\" unless name.present?\n      kind = metadata[:kind]\n      snippet = (kind == 'snippet') || !!metadata[:snippet]\n      oses = metadata[:oses] || []\n      operatingsystems = oses.map { |os| build_operatingsystem(name: os) }.compact\n      ProvisioningTemplateFromFolder.new(\n        template_path: filepath, source_directory: source_directory,\n        name: name, template: content,\n        template_kind: TemplateKind.new(name: kind),\n        snippet: snippet, operatingsystems: operatingsystems\n      )\n    end\n\n    def host(template)\n      operatingsystem = template.operatingsystems.first\n      build_host(operatingsystem: operatingsystem)\n    end\n\n    private","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/foreman/render_templates_from_folder.rb#L44-L80","documentation":"Error \"Could not read name from metadata in template #{filepath}.\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/foreman/render_templates_from_folder.rb:62 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"}