{"record":{"id":"f4b321bab9b6a0ac","repo":"hashicorp/vagrant","slug":"a-version-of-the-box-you-re-loading-is-formatted-i","errorCode":null,"errorMessage":"A version of the box you're loading is formatted in a way that Vagrant cannot parse: '%{version}'. Please reformat the version to be properly formatted. It should be in the format of X.Y.Z.","messagePattern":"A version of the box you're loading is formatted in a way that Vagrant cannot parse: '%(.+?)'\\. Please reformat the version to be properly formatted\\. It should be in the format of X\\.Y\\.Z\\.","errorType":"exception","errorClass":"Vagrant::Errors::BoxMetadataMalformedVersion","httpStatus":null,"severity":"error","filePath":"lib/vagrant/box_metadata.rb","lineNumber":40,"sourceCode":"    # IO.\n    #\n    # @param [IO] io An IO object to read the metadata from.\n    def initialize(io, **_)\n      begin\n        @raw = JSON.load(io)\n      rescue JSON::ParserError => e\n        raise Errors::BoxMetadataMalformed,\n          error: e.to_s\n      end\n\n      @raw ||= {}\n      @name = @raw[\"name\"]\n      @description = @raw[\"description\"]\n      @version_map = (@raw[\"versions\"] || []).map do |v|\n        begin\n          [Gem::Version.new(v[\"version\"]), Version.new(v)]\n        rescue ArgumentError\n          raise Errors::BoxMetadataMalformedVersion,\n            version: v[\"version\"].to_s\n        end\n      end\n      @version_map = Hash[@version_map]\n    end\n\n    # Returns data about a single version that is included in this\n    # metadata.\n    #\n    # @param [String] version The version to return, this can also\n    #   be a constraint.\n    # @option [Symbol, Array<Symbol>] :provider Provider filter\n    # @option [Symbol] :architecture Architecture filter\n    #\n    # @return [Version] The matching version or nil if a matching\n    #   version was not found.\n    def version(version, **opts)\n      requirements = version.split(\",\").map do |v|","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/box_metadata.rb#L22-L58","documentation":"BoxMetadataMalformedVersion is raised in BoxMetadata#initialize (lib/vagrant/box_metadata.rb:40) while building the version map: Gem::Version.new(v[\"version\"]) raises ArgumentError for some entry in the metadata's \"versions\" array. Each version string in catalog metadata must be a parseable version (X.Y.Z form), and the offending string is embedded in the error.","triggerScenarios":"BoxMetadata.new over a catalog whose versions array contains a string like 'v1.2.3', '1..0', 'latest' or a non-string field; the map block rescues ArgumentError and raises with v[\"version\"].to_s. Triggered when Vagrant loads catalog metadata during box add/outdated/update.","commonSituations":"Internally hosted catalogs generated by scripts that prefix 'v' (git tag style); YAML-to-JSON converters emitting floats/nils for versions; third-party boxes published with malformed metadata.","solutions":["If you maintain the metadata, rewrite every versions[].version to plain semver: \"1.2.3\" (no 'v', no spaces)","If it is a third-party box, contact the maintainer and pin to an earlier well-formed version until fixed","As a workaround, add the box directly from the .box artifact URL of the version you need (accepting no update tracking)"],"exampleFix":"# before: metadata.json\n\"versions\": [{\"version\": \"v1.2.3\", \"providers\": [...] }]\n\n# after\n\"versions\": [{\"version\": \"1.2.3\", \"providers\": [...] }]","handlingStrategy":"validation","validationCode":"meta = JSON.parse(File.read(catalog_path))\nmeta.fetch('versions', []).each do |v|\n  Gem::Version.new(v['version']) # raises early if any entry is malformed\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate catalog metadata from a schema that validates versions with Gem::Version before publishing","Avoid git-tag 'v' prefixes in published version fields"],"tags":["vagrant","box","metadata","version","semver","catalog"],"backgroundTag":"invalid-version-string","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}