{"record":{"id":"1c7c06e2e506defb","repo":"hashicorp/vagrant","slug":"a-vagrant-1-0-x-local-state-file-was-found-vagran","errorCode":null,"errorMessage":"A Vagrant 1.0.x local state file was found. Vagrant is able to upgrade\nthis to the latest format automatically, however various checks are\nput in place to verify data isn't incorrectly deleted. In this case,\nthe old state file was not valid JSON. Vagrant 1.0.x would store state\nas valid JSON, meaning that this file was probably tampered with or\nmanually edited. Vagrant's auto-upgrade process cannot continue in this\ncase.\n\nIn most cases, this can be resolve by simply removing the state file.\nNote however though that if Vagrant was previously managing virtual\nmachines, they may be left in an \"orphan\" state. That is, if they are\nrunning or exist, they'll have to manually be removed.\n\nIf you're unsure what to do, ask the Vagrant mailing list or contact\nsupport.\n\nState file path: %{state_file}","messagePattern":"A Vagrant 1\\.0\\.x local state file was found\\. Vagrant is able to upgrade\nthis to the latest format automatically, however various checks are\nput in place to verify data isn't incorrectly deleted\\. In this case,\nthe old state file was not valid JSON\\. Vagrant 1\\.0\\.x would store state\nas valid JSON, meaning that this file was probably tampered with or\nmanually edited\\. Vagrant's auto-upgrade process cannot continue in this\ncase\\.\n\nIn most cases, this can be resolve by simply removing the state file\\.\nNote however though that if Vagrant was previously managing virtual\nmachines, they may be left in an \"orphan\" state\\. That is, if they are\nrunning or exist, they'll have to manually be removed\\.\n\nIf you're unsure what to do, ask the Vagrant mailing list or contact\nsupport\\.\n\nState file path: %\\{state_file\\}","errorType":"exception","errorClass":"Vagrant::Errors::DotfileUpgradeJSONError","httpStatus":null,"severity":"error","filePath":"lib/vagrant/environment.rb","lineNumber":1195,"sourceCode":"      contents = path.read.strip\n      if contents.strip == \"\"\n        @logger.info(\"V1 dotfile was empty. Removing and moving on.\")\n        path.delete\n        return\n      end\n\n      # Otherwise, verify there is valid JSON in here since a Vagrant\n      # environment would always ensure valid JSON. This is a sanity check\n      # to make sure we don't nuke a dotfile that is not ours...\n      @logger.debug(\"Attempting to parse JSON of V1 file\")\n      json_data = nil\n      begin\n        json_data = JSON.parse(contents)\n        @logger.debug(\"JSON parsed successfully. Things are okay.\")\n      rescue JSON::ParserError\n        # The file could've been tampered with since Vagrant 1.0.x is\n        # supposed to ensure that the contents are valid JSON. Show an error.\n        raise Errors::DotfileUpgradeJSONError,\n          state_file: path.to_s\n      end\n\n      # Alright, let's upgrade this guy to the new structure. Start by\n      # backing up the old dotfile.\n      backup_file = path.dirname.join(\".vagrant.v1.#{Time.now.to_i}\")\n      @logger.info(\"Renaming old dotfile to: #{backup_file}\")\n      path.rename(backup_file)\n\n      # Now, we create the actual local data directory. This should succeed\n      # this time since we renamed the old conflicting V1.\n      setup_local_data_path(true)\n\n      if json_data[\"active\"]\n        @logger.debug(\"Upgrading to V2 style for each active VM\")\n        json_data[\"active\"].each do |name, id|\n          @logger.info(\"Upgrading dotfile: #{name} (#{id})\")\n","sourceCodeStart":1177,"sourceCodeEnd":1213,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/environment.rb#L1177-L1213","documentation":"Raised as Vagrant::Errors::DotfileUpgradeJSONError from the Vagrant 1.0.x upgrade path (lib/vagrant/environment.rb:1195): when a legacy single-file `.vagrant` state dotfile exists, Vagrant sanity-checks its contents with JSON.parse before converting it to the modern local-data-directory layout; a JSON::ParserError aborts with this error naming the state file.","triggerScenarios":"Opening a pre-1.1-era project whose `.vagrant` dotfile was hand-edited, truncated, or corrupted (Vagrant 1.0.x always wrote valid JSON), so the auto-upgrade refuses to run to avoid destroying data it does not understand.","commonSituations":"Reviving ancient projects; state files touched by editors or provisioning scripts; files mangled by version-control merges when teams committed the dotfile by accident.","solutions":["Confirm the file is not needed: JSON.parse it yourself (`ruby -rjson -e 'puts JSON.parse(File.read(\".vagrant\"))'`) to see the damage","If no managed VMs depend on it, back it up and remove it: `mv .vagrant .vagrant.v1.bak` — Vagrant then creates a fresh local data dir on next run","If the JSON is nearly valid, fix it by hand so the automatic upgrade can proceed","If VMs were managed, check the hypervisor for orphaned machines before deleting the state file"],"exampleFix":"# before\n$ cat .vagrant\n{\"active\":{\"...\":  }   # truncated/invalid JSON\n$ vagrant up   # DotfileUpgradeJSONError\n\n# after\n$ mv .vagrant .vagrant.v1.bak\n$ vagrant up   # fresh local data dir is created","handlingStrategy":"validation","validationCode":"dotfile = File.join(project_dir, \".vagrant\")\nif File.file?(dotfile) && !File.directory?(dotfile)\n  begin\n    JSON.parse(File.read(dotfile))\n  rescue JSON::ParserError\n    backup = dotfile + \".invalid.#{Time.now.to_i}\"\n    File.rename(dotfile, backup)\n    warn \"moved corrupt V1 state file to #{backup}\"\n  end\nend","typeGuard":null,"tryCatchPattern":"begin\n  env = Vagrant::Environment.new(cwd: project_dir)\nrescue Vagrant::Errors::DotfileUpgradeJSONError => e\n  abort \"Corrupt Vagrant 1.0.x state file #{e.extra_data[:state_file]} — back it up and remove it\"\nend","preventionTips":["Never hand-edit the legacy .vagrant dotfile","Add .vagrant to .gitignore so merges cannot corrupt state","Check the hypervisor for orphaned VMs before discarding old state files"],"tags":["vagrant","legacy-migration","json","state-file","upgrade"],"backgroundTag":"corrupt-state-file","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}