{"record":{"id":"a990aad982bb4f2f","repo":"hashicorp/vagrant","slug":"the-metadata-for-the-box-was-malformed-the-exact","errorCode":null,"errorMessage":"The metadata for the box was malformed. The exact error is shown below. Please contact the maintainer of the box so that this issue can be fixed.\n\n%{error}","messagePattern":"The metadata for the box was malformed\\. The exact error is shown below\\. Please contact the maintainer of the box so that this issue can be fixed\\.\n\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::BoxMetadataMalformed","httpStatus":null,"severity":"error","filePath":"lib/vagrant/box_metadata.rb","lineNumber":29,"sourceCode":"    # The name that the box should be if it is added.\n    #\n    # @return [String]\n    attr_accessor :name\n\n    # The long-form human-readable description of a box.\n    #\n    # @return [String]\n    attr_accessor :description\n\n    # Loads the metadata associated with the box from the given\n    # 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","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/box_metadata.rb#L11-L47","documentation":"BoxMetadataMalformed is raised in BoxMetadata#initialize (lib/vagrant/box_metadata.rb:29) when JSON.load(io) on the catalog metadata raises JSON::ParserError. The parser's message is embedded, so the error shows exactly where the JSON is broken; it points at the metadata maintainer since the document is not valid JSON.","triggerScenarios":"BoxMetadata.new(io) is constructed from a downloaded or file-based metadata source (Box#load_metadata after download, or reading a catalog file) whose content is not parseable JSON — HTML login/error page, truncated body, trailing commas, BOM.","commonSituations":"Self-hosted catalog behind a proxy that returns an HTML block page; internal web server misconfigured to serve the URL as a directory listing; hand-edited metadata.json with a trailing comma; CDN serving partial content.","solutions":["Fetch the exact URL with curl and inspect what is really returned: 'curl -sL -H \"Accept: application/json\" <metadata-url> | head'","If you maintain the metadata, validate it (jq . metadata.json) and fix the reported JSON syntax error","If a proxy/portal intercepts the request, whitelist the host or authenticate so JSON comes through"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"require 'json'\nrequire 'open-uri'\nraw = URI.parse(metadata_url).open.read\nJSON.parse(raw) # raises now, on your terms, if the catalog serves HTML/garbage","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Serve catalog metadata with correct Content-Type from a host that never emits HTML error pages","Check with curl -i after any proxy/network change that the body is real JSON"],"tags":["vagrant","box","metadata","json","catalog","malformed"],"backgroundTag":"malformed-json-response","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}