{"record":{"id":"918f1232017afc7b","repo":"hashicorp/vagrant","slug":"the-private-key-you-are-attempting-to-generate-is","errorCode":null,"errorMessage":"The private key you are attempting to generate is not supported by\nthe guest SSH server. Please use one of the available key types defined\nbelow that is supported by the guest SSH server.\n\nRequested: %{requested_key_type}\nAvailable: %{available_key_types}","messagePattern":"The private key you are attempting to generate is not supported by\nthe guest SSH server\\. Please use one of the available key types defined\nbelow that is supported by the guest SSH server\\.\n\nRequested: %(.+?)\nAvailable: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::SSHKeyTypeNotSupportedByServer","httpStatus":null,"severity":"error","filePath":"plugins/communicators/ssh/communicator.rb","lineNumber":221,"sourceCode":"                  end\n                  nil\n                rescue => err\n                  @logger.warn(\"Failed to check key types server supports: #{err}\")\n                  nil\n                end\n              end\n\n              @logger.debug(\"Detected key type for new private key: #{key_type}\")\n\n              # If no key type was discovered, default to rsa\n              if key_type.nil?\n                @logger.debug(\"Failed to detect supported key type in: #{supported_key_types.join(\", \")}\")\n                available_types = supported_key_types.map { |t|\n                  next if !Vagrant::Util::Keypair::PREFER_KEY_TYPES.key?(t)\n                  \"#{t} (#{Vagrant::Util::Keypair::PREFER_KEY_TYPES[t]})\"\n                }.compact.join(\", \")\n\n                raise Vagrant::Errors::SSHKeyTypeNotSupportedByServer,\n                      requested_key_type: \":auto\",\n                      available_key_types: available_types\n              end\n            else\n              type_name = Vagrant::Util::Keypair::PREFER_KEY_TYPES.key(key_type)\n              if !supports_key_type?(type_name)\n                available_types = supported_key_types.map { |t|\n                  next if !Vagrant::Util::Keypair::PREFER_KEY_TYPES.key?(t)\n                  \"#{t} (#{Vagrant::Util::Keypair::PREFER_KEY_TYPES[t]})\"\n                }.compact.join(\", \")\n                raise Vagrant::Errors::SSHKeyTypeNotSupportedByServer,\n                      requested_key_type: \"#{type_name} (#{key_type})\",\n                      available_key_types: available_types\n              end\n            end\n          rescue ServerDataError\n            @logger.warn(\"failed to load server data for key type check\")\n            if key_type.nil? || key_type == :auto","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/communicators/ssh/communicator.rb#L203-L239","documentation":"With `config.ssh.key_type = :auto` (the default), the SSH communicator probes the guest SSH server for supported key algorithms. If none of the preferred key types (Vagrant::Util::Keypair::PREFER_KEY_TYPES, e.g. ed25519/rsa variants) is supported, detection yields nil and SSHKeyTypeNotSupportedByServer is raised with requested type ':auto' and the available types listed. This is the :auto branch of the key-type check during insecure-key replacement.","triggerScenarios":"A guest sshd so old or restricted that its advertised algorithms intersect none of Vagrant's preferred key types; probing that fails for every candidate so the catch(:key_type) loop returns nil.","commonSituations":"Ancient boxes with early OpenSSH; dropbear-based appliances without ed25519; corporate-hardened sshd images restricting key algorithms; guests where SSH banner/algorithm probing is flaky.","solutions":["Set an explicit broadly-supported type: `config.ssh.key_type = 'rsa'`, then `vagrant reload`","Upgrade the guest's OpenSSH so it advertises modern key types (ed25519 needs OpenSSH >= 6.5)","If probing failed spuriously, fix guest connectivity and reload — on ServerDataError Vagrant falls back to RSA automatically"],"exampleFix":"# before\nVagrant.configure('2') do |config|\n  config.vm.box = 'ancient-box'\n  # key_type defaults to :auto -> detection finds nothing\nend\n\n# after\nVagrant.configure('2') do |config|\n  config.vm.box = 'ancient-box'\n  config.ssh.key_type = 'rsa'\nend","handlingStrategy":"fallback","validationCode":"algs = `vagrant ssh -c 'sshd -T 2>&1 | grep -i hostkeyalgorithms'`\nputs algs  # confirm ed25519/rsa appear before relying on :auto key type","typeGuard":null,"tryCatchPattern":"begin\n  env.cli('up')\nrescue Vagrant::Errors::SSHKeyTypeNotSupportedByServer => e\n  warn \"supported: #{e.extra_data[:available_key_types]}\"\n  # pin config.ssh.key_type = 'rsa' in the Vagrantfile, then `vagrant reload`\nend","preventionTips":["Pin `config.ssh.key_type = 'rsa'` for guests with old or exotic sshd","Upgrade guest OpenSSH (>= 6.5) when you need ed25519","Check the guest's advertised algorithms before standardizing on :auto"],"tags":["vagrant","ssh","keys","key-type","ssh-server-algorithms"],"backgroundTag":"unsupported-key-type","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}