{"record":{"id":"e52a3b8016a84c3a","repo":"hashicorp/vagrant","slug":"the-defined-alias-is-not-valid-please-review-the","errorCode":null,"errorMessage":"The defined alias is not valid. Please review the information below to help resolve the issue:\n\nAlias: %{alias}\nMessage: %{message}","messagePattern":"The defined alias is not valid\\. Please review the information below to help resolve the issue:\n\nAlias: %(.+?)\nMessage: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::AliasInvalidError","httpStatus":null,"severity":"error","filePath":"lib/vagrant/alias.rb","lineNumber":39,"sourceCode":"        end\n      end\n    end\n\n    # This returns all the registered alias commands.\n    def commands\n      @aliases\n    end\n\n    # This interprets a raw line from the aliases file.\n    def interpret(line)\n      # is it a comment?\n      return nil if line.strip.start_with?(\"#\")\n\n      keyword, command = line.split(\"=\", 2).collect(&:strip)\n\n      # validate the keyword\n      if keyword.match(/\\s/i)\n        raise Errors::AliasInvalidError, alias: line, message: \"Alias keywords must not contain any whitespace.\"\n      end\n\n      [keyword, command]\n    end\n\n    # This registers an alias.\n    def register(keyword, command)\n      @aliases.register(keyword.to_sym) do\n        lambda do |args|\n          # directly execute shell commands\n          if command.start_with?(\"!\")\n            return Util::SafeExec.exec \"#{command[1..-1]} #{args.join(\" \")}\".strip\n          end\n\n          return CLI.new(command.split.concat(args), @env).execute\n        end\n      end\n    end","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/alias.rb#L21-L57","documentation":"AliasInvalidError is raised by Vagrant::Alias#interpret (lib/vagrant/alias.rb:39) when parsing a line of the user's aliases file and the keyword portion (text left of '=') contains whitespace. The keyword must be a single shell-like token because it is registered as a CLI command override via @aliases.register(keyword.to_sym).","triggerScenarios":"A line like 'my alias = up' or 'v up=up' in ~/.vagrant.d/aliases: line.split(\"=\", 2) yields keyword 'my alias' / 'v up', keyword.match(/\\s/i) succeeds, and the error is raised with the offending line and message while Vagrant loads aliases at startup.","commonSituations":"Hand-editing the aliases file and using spaces in the keyword; copy-pasting alias examples written shell-style ('alias vup=...'); trailing tabs or double spaces introduced by editors.","solutions":["Edit ~/.vagrant.d/aliases (or the configured aliases file) and rewrite the keyword without whitespace, e.g. 'v-up = up'","Use hyphens or underscores to join words in the keyword","Remove or comment out (leading '#') any experimental line causing the failure, then re-add corrected"],"exampleFix":"# before (~/.vagrant.d/aliases)\nvagrant up all = up\n\n# after\nv-up = up","handlingStrategy":"validation","validationCode":"# Validate aliases file before Vagrant parses it\nPathname.new(File.join(Vagrant.source_root ? Dir.pwd : Dir.home, '.vagrant.d', 'aliases')) rescue nil\npath = File.join(ENV['VAGRANT_HOME'] || File.join(Dir.home, '.vagrant.d'), 'aliases')\nif File.exist?(path)\n  File.readlines(path).each do |line|\n    next if line.strip.start_with?('#') || line.strip.empty?\n    keyword, = line.split('=', 2)\n    if keyword.nil? || keyword.match(/\\s/)\n      raise \"Fix alias line before launch: #{line.inspect}\"\n    end\n  end\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep alias keywords single-token: letters, digits, hyphens, underscores only","Lint the aliases file in dotfiles CI so whitespace keywords never reach Vagrant"],"tags":["vagrant","alias","configuration","whitespace","startup"],"backgroundTag":"config-parse-error","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}