{"record":{"id":"75ba97bb3db9f5e1","repo":"theforeman/foreman","slug":"can-not-load-datacenters-due-to-an-incorrect-user","errorCode":null,"errorMessage":"Can not load datacenters due to an incorrect user name or password.","messagePattern":"Can not load datacenters due to an incorrect user name or password\\.","errorType":"exception","errorClass":"Foreman::UsernameOrPasswordException","httpStatus":null,"severity":"error","filePath":"app/models/compute_resources/foreman/model/vmware.rb","lineNumber":799,"sourceCode":"    rescue Foreman::FingerprintException => e\n      self.pubkey_hash = e.fingerprint\n    end\n\n    def client\n      @client ||= ::Fog::Compute.new(\n        :provider                     => \"vsphere\",\n        :vsphere_username             => user,\n        :vsphere_password             => password,\n        :vsphere_server               => server,\n        :vsphere_expected_pubkey_hash => pubkey_hash\n      )\n    rescue => e\n      case e.message\n      when /The remote system presented a public key with hash (\\w+) but we're expecting a hash of/\n        raise Foreman::FingerprintException.new(\n          N_(\"The remote system presented a public key with hash %s but we're expecting a different hash. If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' or 'Load Datacenters' button and submit\"), Regexp.last_match(1))\n      when /Cannot complete login due to an incorrect user name or password./\n        raise Foreman::UsernameOrPasswordException.new(\n          N_(\"Can not load datacenters due to an incorrect user name or password.\"))\n      else\n        raise e\n      end\n    end\n\n    def unused_vnc_port(ip)\n      10.times do\n        port   = rand(5901..5964)\n        unused = (TCPSocket.connect(ip, port).close rescue true)\n        return port if unused\n      end\n      raise \"no unused port found\"\n    end\n\n    def vm_instance_defaults\n      super.merge(\n        :memory_mb  => 2048,","sourceCodeStart":781,"sourceCodeEnd":817,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/models/compute_resources/foreman/model/vmware.rb#L781-L817","documentation":"Error \"Can not load datacenters due to an incorrect user name or password.\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/models/compute_resources/foreman/model/vmware.rb:799 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"}