{"record":{"id":"4c675a06a7ee80c0","repo":"hashicorp/vagrant","slug":"the-metadata-associated-with-the-box-name-app-4c675a","errorCode":null,"errorMessage":"The metadata associated with the box '%{name}' appears to be missing the required field '%{required_field}'. Please ensure `metadata.json` has all required fields.\n\nRequired fields: %{all_fields}","messagePattern":"The metadata associated with the box '%(.+?)' appears to be missing the required field '%(.+?)'\\. Please ensure `metadata\\.json` has all required fields\\.\n\nRequired fields: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::BoxMetadataMissingRequiredFields","httpStatus":null,"severity":"error","filePath":"lib/vagrant/box.rb","lineNumber":100,"sourceCode":"\n      metadata_file = directory.join(\"metadata.json\")\n      raise Errors::BoxMetadataFileNotFound, name: @name if !metadata_file.file?\n\n      begin\n        @metadata = JSON.parse(directory.join(\"metadata.json\").read)\n        validate_metadata_json(@metadata)\n      rescue JSON::ParserError\n        raise Errors::BoxMetadataCorrupted, name: @name\n      end\n\n      @logger = Log4r::Logger.new(\"vagrant::box\")\n    end\n\n    def validate_metadata_json(metadata)\n      metatdata_fields = metadata.keys\n      REQUIRED_METADATA_FIELDS.each do |field|\n        if !metatdata_fields.include?(field)\n          raise Errors::BoxMetadataMissingRequiredFields,\n            name: @name,\n            required_field: field,\n            all_fields: REQUIRED_METADATA_FIELDS.join(\", \")\n        end\n      end\n    end\n\n    # This deletes the box. This is NOT undoable.\n    def destroy!\n      # Delete the directory to delete the box.\n      FileUtils.rm_r(@directory)\n\n      # Just return true always\n      true\n    rescue Errno::ENOENT\n      # This means the directory didn't exist. Not a problem.\n      return true\n    end","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/box.rb#L82-L118","documentation":"BoxMetadataMissingRequiredFields is raised by Box#validate_metadata_json (lib/vagrant/box.rb:100) when the parsed metadata.json lacks one of REQUIRED_METADATA_FIELDS, which for Box is [\"provider\"]. The JSON parses cleanly but the schema check fails, so Vagrant cannot determine which provider the box targets.","triggerScenarios":"Box.new successfully JSON.parses metadata.json but metadata.keys does not include 'provider' — e.g. the file contains {\"name\": \"x\"} or an unrelated JSON document. Raised during box add/finalization and any later instantiation of that Box.","commonSituations":"Custom-built boxes packaged without a proper metadata.json; metadata.json borrowed from a box catalog (catalog metadata has 'providers' inside versions, not a top-level 'provider'); typos like \"Provider\" or \"providers\".","solutions":["Add the missing field to the box's metadata.json: {\"provider\": \"virtualbox\"} (or your target provider)","If you meant to ship catalog-style metadata, instead package the box as a plain .box whose metadata.json is the simple {\"provider\": ...} form","Remove and re-add the fixed box so Vagrant re-validates it"],"exampleFix":"# before: metadata.json\n{\"name\": \"mybox\"}\n\n# after\n{\"name\": \"mybox\", \"provider\": \"virtualbox\"}","handlingStrategy":"validation","validationCode":"require 'json'\nmeta = JSON.parse(File.read(File.join(box_dir, 'metadata.json')))\nraise 'metadata.json missing \"provider\"' unless meta.key?('provider')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When packaging boxes, always include a minimal metadata.json: {\"provider\": \"<your provider>\"}","Validate custom boxes with jq before distributing: jq -e '.provider' metadata.json"],"tags":["vagrant","box","metadata","schema","required-field"],"backgroundTag":"missing-required-json-field","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}