{"record":{"id":"b90d8e1d51ff46f9","repo":"theforeman/foreman","slug":"error-has-occurred-while-communicating-with-cr","errorCode":null,"errorMessage":"Error has occurred while communicating with %{cr}: %{e}","messagePattern":"Error has occurred while communicating with %(.+?): %(.+?)","errorType":"exception","errorClass":"Foreman::Exception","httpStatus":null,"severity":"error","filePath":"app/services/power_manager/virt.rb","lineNumber":15,"sourceCode":"require 'timeout'\n\nmodule PowerManager\n  class Virt < Base\n    def initialize(opts = {})\n      super(opts)\n      begin\n        Timeout.timeout(15) do\n          @vm = host.compute_resource.find_vm_by_uuid(host.uuid)\n        end\n      rescue Timeout::Error\n        raise Foreman::Exception.new(N_(\"Timeout has occurred while communicating with %s\"), host.compute_resource)\n      rescue => e\n        Foreman::Logging.exception(\"Error has occurred while communicating to #{host.compute_resource}\", e)\n        raise Foreman::Exception.new(N_(\"Error has occurred while communicating with %{cr}: %{e}\"), { :cr => host.compute_resource, :e => e })\n      end\n    end\n\n    def virt_state\n      # make sure we fetch latest vm status\n      vm.reload\n      vm.state\n    end\n\n    def state_output(result)\n      result = result.to_s\n      return 'on' if result.match?(/started|running/i)\n      return 'off' if result.match?(/paused|stopped/i)\n      translate_status(result) # unknown output\n    end\n\n    def default_action(action)\n      vm.send(action)","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/power_manager/virt.rb#L1-L33","documentation":"Error \"Error has occurred while communicating with %{cr}: %{e}\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/power_manager/virt.rb:15 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}