hashicorp/vagrant · error · Vagrant::Errors::CapabilityHostNotDetected
The capability host could not be detected. This is an intern
Error message
The capability host could not be detected. This is an internal error that users should never see. Please report a bug.
What it means
CapabilityHostNotDetected is raised in initialize_capabilities! (lib/vagrant/capability_host.rb:40) when no host was given and autodetect_capability_host could not find any registered host whose detect? returns true. For guests this means Vagrant could not identify the operating system inside the machine; for hosts, the running platform was not recognized.
Source
Thrown at lib/vagrant/capability_host.rb:40
# we should auto-detect it.
# @param [Hash<Symbol, Array<Class, Symbol>>] hosts Potential capability
# hosts. The key is the name of the host, value[0] is a class that
# implements `#detect?` and value[1] is a parent host (if any).
# @param [Hash<Symbol, Hash<Symbol, Class>>] capabilities The capabilities
# that are supported. The key is the host of the capability. Within that
# is a hash where the key is the name of the capability and the value
# is the class/module implementing it.
def initialize_capabilities!(host, hosts, capabilities, *args)
@cap_logger = Log4r::Logger.new(
"vagrant::capability_host::#{self.class.to_s.downcase}")
if host && !hosts[host]
raise Errors::CapabilityHostExplicitNotDetected, value: host.to_s
end
if !host
host = autodetect_capability_host(hosts, *args) if !host
raise Errors::CapabilityHostNotDetected if !host
end
if !hosts[host]
# This should never happen because the autodetect above uses the
# hosts hash to look up hosts. And if an explicit host is specified,
# we do another check higher up.
raise "Internal error. Host not found: #{host}"
end
name = host
host_info = hosts[name]
host = host_info[0].new
chain = []
chain << [name, host]
# Build the proper chain of parents if there are any.
# This allows us to do "inheritance" of capabilities later
if host_info[1]View on GitHub (pinned to 35f3160f4a)
Solutions
- Set the host explicitly so detection is skipped: 'config.vm.guest = :linux' (or :windows)
- Fix the underlying communicator first: verify 'vagrant ssh' works, correct credentials/ssh config in the Vagrantfile
- Try a standard upstream box for the same OS to confirm the box, not Vagrant, is the problem; report/fix box detection hints
Example fix
# before (Vagrantfile) # (no guest setting, autodetect fails on minimal box) # after config.vm.guest = :linux
Defensive patterns
Strategy: fallback
Validate before calling
# sanity-check communicator before relying on guest autodetect raise 'ssh unreachable' unless machine.communicate.ready?
Prevention
- Prefer standard upstream boxes whose OS detection works out of the box
- Set config.vm.guest explicitly in Vagrantfiles for minimal/custom images
When it happens
Trigger: host is nil and autodetect_capability_host(hosts, *args) returns nil after trying each host class's detect? — commonly Guest#new during 'vagrant up' when the guest OS cannot be probed (communicator broken, unusual distro, box lacking hints), or on an unsupported host platform without the right plugin.
Common situations: Boxes with exotic/minimal OSes (busybox, custom images) where detection scripts fail; SSH/WinRM broken so detection commands never run; exotic host platforms needing a provider plugin; heavily stripped boxes with no /etc/os-release.
Related errors
- The explicit capability host specified of '%{value}' could n
- The guest implementation explicitly specified in your Vagran
- The host implementation explicitly specified in your Vagrant
- Vagrant attempted to execute the capability '%{cap}' on the
- This Vagrant environment has specified that it requires the
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/5e0d015234056345.
Report an issue: GitHub.