{"record":{"id":"8b0f5cba925b2d4a","repo":"theforeman/foreman","slug":"metadata-could-not-be-parsed-it-seems-to-be-empty","errorCode":null,"errorMessage":"Metadata could not be parsed, it seems to be empty","messagePattern":"Metadata could not be parsed, it seems to be empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/seed_helper.rb","lineNumber":105,"sourceCode":"        missing_permissions = desired_permissions - existing_permissions\n        if missing_permissions.present?\n          role.add_permissions(missing_permissions, :save! => true)\n        end\n\n        # The built in role may have additional permissions added to it by users.\n        # To remove permissions from the default role use an explicit migration.\n        return if role.builtin == Role::BUILTIN_DEFAULT_ROLE\n\n        extra_permissions = existing_permissions - desired_permissions\n        if extra_permissions.present?\n          role.remove_permissions!(extra_permissions)\n        end\n      end\n    end\n\n    def import_raw_template(contents, vendor = 'Foreman')\n      metadata = Template.parse_metadata(contents)\n      raise \"Metadata could not be parsed, it seems to be empty\" if metadata.empty?\n      raise \"Attribute 'name' is required in metadata in order to seed the template\" if metadata['name'].nil?\n      raise \"Attribute 'model' is required in metadata in order to seed the template\" if metadata['model'].nil?\n\n      name = metadata['name']\n      requirements = metadata['require'] || []\n\n      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","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/lib/seed_helper.rb#L87-L123","documentation":"Error \"Metadata could not be parsed, it seems to be empty\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at lib/seed_helper.rb:105 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"}