theforeman/foreman · error · Net::Validations::Error

Invalid hostname #{hostname}

Error message

Invalid hostname #{hostname}

What it means

Error "Invalid hostname #{hostname}" thrown in theforeman/foreman.

Source

Thrown at app/lib/net/validations.rb:98

    def self.broadcast_mac?(mac)
      return false unless validate_mac(mac)
      mac.downcase == 'ff:ff:ff:ff:ff:ff'
    end

    # validates the mac and raises an error
    def self.validate_mac!(mac)
      raise Error, "Invalid MAC #{mac}" unless validate_mac(mac)
      mac
    end

    # validates the hostname
    def self.validate_hostname(hostname)
      HOST_REGEXP.match?(hostname)
    end

    # validates the hostname and raises an error
    def self.validate_hostname!(hostname)
      raise Error, "Invalid hostname #{hostname}" unless validate_hostname(hostname)
      hostname
    end

    def self.validate_network(network)
      validate_ip(network)
    end

    def self.validate_network!(network)
      raise(Error, "Invalid Network #{network}") unless validate_network(network)
      network
    end

    # ensures that the ip address does not contain any leading spaces or invalid strings
    def self.normalize_ip(ip)
      return unless ip.present?
      return ip unless ip =~ IP_REGEXP
      ip.split(".").map(&:to_i).join(".")
    end

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/lib/net/validations.rb:98 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/b5b9276d2f2d0a47. Report an issue: GitHub.