{"record":{"id":"e9d9493b10e5ae4e","repo":"hashicorp/vagrant","slug":"the-provider-for-this-vagrant-managed-machine-is-r-e9d949","errorCode":null,"errorMessage":"The provider for this Vagrant-managed machine is reporting that it\nis not yet ready for SSH. Depending on your provider this can carry\ndifferent meanings. Make sure your machine is created and running and\ntry again. Additionally, check the output of `vagrant status` to verify\nthat the machine is in the state that you expect. If you continue to\nget this error message, please view the documentation for the provider\nyou're using.","messagePattern":"The provider for this Vagrant-managed machine is reporting that it\nis not yet ready for SSH\\. Depending on your provider this can carry\ndifferent meanings\\. Make sure your machine is created and running and\ntry again\\. Additionally, check the output of `vagrant status` to verify\nthat the machine is in the state that you expect\\. If you continue to\nget this error message, please view the documentation for the provider\nyou're using\\.","errorType":"exception","errorClass":"Vagrant::Errors::SSHNotReady","httpStatus":null,"severity":"error","filePath":"lib/vagrant/action/builtin/ssh_run.rb","lineNumber":32,"sourceCode":"      # mirror the output to the UI. The resulting exit status of the command\n      # will exist in the `:ssh_run_exit_status` key in the environment.\n      class SSHRun\n        # For quick access to the `SSH` class.\n        include Vagrant::Util\n\n        def initialize(app, env)\n          @app    = app\n          @logger = Log4r::Logger.new(\"vagrant::action::builtin::ssh_run\")\n        end\n\n        def call(env)\n          # Grab the SSH info from the machine or the environment\n          info = env[:ssh_info]\n          info ||= env[:machine].ssh_info\n\n          # If the result is nil, then the machine is telling us that it is\n          # not yet ready for SSH, so we raise this exception.\n          raise Errors::SSHNotReady if info.nil?\n\n          info[:private_key_path] ||= []\n\n          if info[:keys_only] && info[:private_key_path].empty?\n            raise Errors::SSHRunRequiresKeys\n          end\n\n          # Get the command and wrap it in a login shell\n          command = ShellQuote.escape(env[:ssh_run_command], \"'\")\n\n          if env[:machine].config.vm.communicator == :winssh\n            shell = env[:machine].config.winssh.shell\n          else\n            shell = env[:machine].config.ssh.shell\n          end\n\n          if shell == \"cmd\"\n            # Add an extra space to the command so cmd.exe quoting works","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/action/builtin/ssh_run.rb#L14-L50","documentation":"The ssh_run middleware (`vagrant ssh -c \"cmd\"`) uses the same contract as ssh_exec: env/machine ssh_info must be non-nil or the provider is declaring the machine not ready for SSH, and SSHNotReady is raised before the remote command is built. The difference from ssh_exec is only the entry point — running a one-off command instead of an interactive session.","triggerScenarios":"Running `vagrant ssh -c \"uptime\"` (or any API path that sets ssh_run_command) while machine.ssh_info returns nil — machine not created, halted, aborted, or provider container stopped (lib/vagrant/action/builtin/ssh_run.rb:23-34).","commonSituations":"Automation that runs a command via `vagrant ssh -c` right after triggering up asynchronously; provisioning-style scripts that assume the VM stays running; machine crashed mid-boot leaving state 'aborted'.","solutions":["Check `vagrant status` and bring the machine up (`vagrant up`) before issuing `vagrant ssh -c`.","For scripts, chain the commands so up completes first: `vagrant up && vagrant ssh -c '...'`.","If state is abnormal ('aborted', stuck), `vagrant reload` or `vagrant destroy && vagrant up`."],"exampleFix":"# before\nvagrant ssh -c 'docker ps'   # machine halted => SSHNotReady\n\n# after\nvagrant up && vagrant ssh -c 'docker ps'","handlingStrategy":"try-catch","validationCode":"# Shell: run remote commands only against a running machine\nstate=$(vagrant status --machine-readable | awk -F, '$3==\"state-id\"{print $4}')\n[ \"$state\" = \"running\" ] && vagrant ssh -c \"$CMD\" || { vagrant up >/dev/null && vagrant ssh -c \"$CMD\"; }","typeGuard":"# Ruby: predicate guard before ssh_run-style APIs\ndef runnable?(machine)\n  %w[running].include?(machine.state.id.to_s) && !machine.ssh_info.nil?\nend","tryCatchPattern":"# Ruby: one retry after up, then give up with a clear message\nbegin\n  env[:machine].communicate.execute(cmd)\nrescue Vagrant::Errors::SSHNotReady\n  env[:machine].action(\"up\")\n  env[:machine].communicate.execute(cmd)\nend","preventionTips":["Never fire `vagrant ssh -c` concurrently with a background `vagrant up`; wait for the up to finish first.","Use `vagrant status --machine-readable` in automation to gate remote commands on state-id 'running'.","Prefer `vagrant provision` for boot-time setup so scripts don't depend on ad-hoc ssh timing."],"tags":["vagrant","ssh","machine-state","remote-command"],"backgroundTag":"machine-not-running","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}