{"record":{"id":"02318c773115ebca","repo":"hashicorp/vagrant","slug":"trigger-configured-to-continue-on-error","errorCode":null,"errorMessage":"Trigger configured to continue on error...","messagePattern":"Trigger configured to continue on error\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/vagrant/plugin/v2/trigger.rb","lineNumber":292,"sourceCode":"                options[:color] = :red if !config.keep_color\n              end\n\n              @ui.detail(data, **options)\n            end\n            if !exit_codes.include?(result.exit_code)\n              raise Errors::TriggersBadExitCodes,\n                code: result.exit_code\n            end\n          rescue => e\n            @ui.error(I18n.t(\"vagrant.errors.triggers_run_fail\"))\n            @ui.error(e.message)\n\n            if on_error == :halt\n              @logger.debug(\"Trigger run encountered an error. Halting on error...\")\n              raise e\n            else\n              @logger.debug(\"Trigger run encountered an error. Continuing on anyway...\")\n              @ui.warn(I18n.t(\"vagrant.trigger.on_error_continue\"))\n            end\n          end\n        end\n\n        # Runs a script on the guest\n        #\n        # @param [ShellProvisioner/Config] config A Shell provisioner config\n        def run_remote(config, on_error, exit_codes)\n          if !@machine\n            # machine doesn't even exist.\n            if on_error == :halt\n              raise Errors::TriggersGuestNotExist\n            else\n              @ui.warn(I18n.t(\"vagrant.errors.triggers_guest_not_exist\"))\n              @ui.warn(I18n.t(\"vagrant.trigger.on_error_continue\"))\n              return\n            end\n          elsif @machine.state.id != :running","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/plugin/v2/trigger.rb#L274-L310","documentation":"When a trigger's executed command fails — either TriggersBadExitCodes (exit code not in the allowed exit_codes list) or any raised exception — trigger.rb prints 'Trigger run encountered an error' plus the exception. If the trigger was configured with on_error: :continue, it then warns with vagrant.trigger.on_error_continue ('Trigger configured to continue on error...') and swallows the failure. This entry is that warning: an inner command failed but the Vagrant run proceeds by design.","triggerScenarios":"A trigger with on_error: :continue whose run command exits non-zero or raises (missing script path, failing inline command, exit code not listed in exit_codes), during up/destroy/trigger runs; the generic rescue => e converts the failure into this warning.","commonSituations":"Best-effort CI triggers (notifications, cleanups) where failure shouldn't abort; accidentally setting :continue and never noticing real deploy-script failures; go/ruby triggers referencing files not on the host.","solutions":["Treat the 'Trigger run encountered an error' line printed just above as the real failure and inspect its message","Temporarily switch the trigger to on_error: :halt (the default) so failures stop the run and surface fully","Fix the inner command: correct path/permissions, and whitelist expected codes via exit_codes: [0, 2]","Keep :continue only for genuinely optional triggers"],"exampleFix":"# before\nconfig.trigger.after :up do |t|\n  t.run = { inline: \"./notify.sh\" }\n  t.on_error = :continue   # failure silently downgraded to warning\nend\n\n# after\nconfig.trigger.after :up do |t|\n  t.run = { inline: \"./notify.sh\" }\n  t.on_error = :halt\n  t.exit_codes = [0, 2]\nend","handlingStrategy":"fallback","validationCode":"# dry-run the trigger command before wiring it into a :continue trigger\nsystem(\"./notify.sh\") or ui.warn(\"notify.sh fails - fix before adding as trigger\")","typeGuard":"def trigger_halt?(trigger_config)\n  trigger_config.on_error != :continue\nend","tryCatchPattern":"# mirror trigger.rb's own rescue when scripting around triggers\nbegin\n  run_trigger_command(cmd)\nrescue => e\n  raise if on_error == :halt\n  ui.error(\"trigger failed, continuing: #{e.message}\")\nend","preventionTips":["Default triggers to on_error: :halt; opt into :continue per-trigger only for best-effort steps","Pin exit_codes lists so expected failures don't even warn","During debugging, flip :continue to :halt so real errors stop the run"],"tags":["triggers","on-error","continue","warning","vagrantfile"],"backgroundTag":"trigger-continue-on-error","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}