hashicorp/vagrant · warning
Could not run remote script on guest because it does not exi
Error message
Could not run remote script on guest because it does not exist.
What it means
run_remote executes a shell-provisioner config on the guest (trigger option run_remote). When @machine is nil — the environment has no machine — there is nothing to run on: with on_error :halt it raises Errors::TriggersGuestNotExist; otherwise it warns with the shared triggers_guest_not_exist text ('Could not run remote script on guest because it does not exist.') plus the continue warning, then returns. The message is the locale text for this condition.
Source
Thrown at lib/vagrant/plugin/v2/trigger.rb:306
@logger.debug("Trigger run encountered an error. Halting on error...")
raise e
else
@logger.debug("Trigger run encountered an error. Continuing on anyway...")
@ui.warn(I18n.t("vagrant.trigger.on_error_continue"))
end
end
end
# Runs a script on the guest
#
# @param [ShellProvisioner/Config] config A Shell provisioner config
def run_remote(config, on_error, exit_codes)
if !@machine
# machine doesn't even exist.
if on_error == :halt
raise Errors::TriggersGuestNotExist
else
@ui.warn(I18n.t("vagrant.errors.triggers_guest_not_exist"))
@ui.warn(I18n.t("vagrant.trigger.on_error_continue"))
return
end
elsif @machine.state.id != :running
if on_error == :halt
raise Errors::TriggersGuestNotRunning,
machine_name: @machine.name,
state: @machine.state.id
else
@machine.ui.error(I18n.t("vagrant.errors.triggers_guest_not_running",
machine_name: @machine.name,
state: @machine.state.id))
@machine.ui.warn(I18n.t("vagrant.trigger.on_error_continue"))
return
end
end
prov = VagrantPlugins::Shell::Provisioner.new(@machine, config)View on GitHub (pinned to 35f3160f4a)
Solutions
- Create/boot the machine first (vagrant up) so run_remote has a target
- Scope guest triggers to lifecycle points where the machine exists, e.g. after :up rather than before :up
- Use host-side run triggers for commands that must fire regardless of machine state
- Accept the warning if nonexistence is expected and harmless in your flow
Example fix
# before
config.trigger.before :destroy do |t|
t.run_remote = { inline: "echo bye" } # machine gone at destroy time
end
# after
config.trigger.before :destroy do |t|
t.run = { inline: "echo bye from host" } # host-side, always runnable
end Defensive patterns
Strategy: validation
Validate before calling
# guard guest triggers on machine existence in tooling return if machine.nil? || machine.state.id == :not_created
Type guard
def guest_trigger_runnable?(machine) !machine.nil? && machine.state.id == :running end
Try / catch
begin
trigger.run_remote(config, :halt, exit_codes)
rescue Vagrant::Errors::TriggersGuestNotExist
ui.warn("skipping guest trigger: machine does not exist (not created yet)")
end Prevention
- Scope run_remote triggers to after :up or other points where the machine exists
- Use host-side run triggers for must-fire commands
- When testing triggers standalone, boot the machine first or expect this warning
When it happens
Trigger: A trigger with run_remote = { inline: ... } firing in a context where the machine doesn't exist yet or anymore: `vagrant triggers run` outside an up'd environment, destroy-time triggers, or before-create lifecycle points — with on_error != :halt downgrading the raise to this warning.
Common situations: Guest triggers scoped to commands that run before creation or after destruction; running standalone `vagrant triggers run` for testing; shared Vagrantfiles where guest triggers fire on machines never booted.
Related errors
- Could not run remote script on %{machine_name} because its s
- Trigger configured to continue on error...
- The explicit capability host specified of '%{value}' could n
- The capability host could not be detected. This is an intern
- The guest implementation explicitly specified in your Vagran
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/97b96ed907a5f5f1.
Report an issue: GitHub.