theforeman/foreman · error · Foreman::UsernameOrPasswordException

Can not load datacenters due to an incorrect user name or pa

Error message

Can not load datacenters due to an incorrect user name or password.

What it means

Error "Can not load datacenters due to an incorrect user name or password." thrown in theforeman/foreman.

Source

Thrown at app/models/compute_resources/foreman/model/vmware.rb:799

    rescue Foreman::FingerprintException => e
      self.pubkey_hash = e.fingerprint
    end

    def client
      @client ||= ::Fog::Compute.new(
        :provider                     => "vsphere",
        :vsphere_username             => user,
        :vsphere_password             => password,
        :vsphere_server               => server,
        :vsphere_expected_pubkey_hash => pubkey_hash
      )
    rescue => e
      case e.message
      when /The remote system presented a public key with hash (\w+) but we're expecting a hash of/
        raise Foreman::FingerprintException.new(
          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))
      when /Cannot complete login due to an incorrect user name or password./
        raise Foreman::UsernameOrPasswordException.new(
          N_("Can not load datacenters due to an incorrect user name or password."))
      else
        raise e
      end
    end

    def unused_vnc_port(ip)
      10.times do
        port   = rand(5901..5964)
        unused = (TCPSocket.connect(ip, port).close rescue true)
        return port if unused
      end
      raise "no unused port found"
    end

    def vm_instance_defaults
      super.merge(
        :memory_mb  => 2048,

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/models/compute_resources/foreman/model/vmware.rb:799 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/75ba97bb3db9f5e1. Report an issue: GitHub.