{"record":{"id":"b5b9276d2f2d0a47","repo":"theforeman/foreman","slug":"invalid-hostname-hostname","errorCode":null,"errorMessage":"Invalid hostname #{hostname}","messagePattern":"Invalid hostname #(.+?)","errorType":"validation","errorClass":"Net::Validations::Error","httpStatus":null,"severity":"error","filePath":"app/lib/net/validations.rb","lineNumber":98,"sourceCode":"    def self.broadcast_mac?(mac)\n      return false unless validate_mac(mac)\n      mac.downcase == 'ff:ff:ff:ff:ff:ff'\n    end\n\n    # validates the mac and raises an error\n    def self.validate_mac!(mac)\n      raise Error, \"Invalid MAC #{mac}\" unless validate_mac(mac)\n      mac\n    end\n\n    # validates the hostname\n    def self.validate_hostname(hostname)\n      HOST_REGEXP.match?(hostname)\n    end\n\n    # validates the hostname and raises an error\n    def self.validate_hostname!(hostname)\n      raise Error, \"Invalid hostname #{hostname}\" unless validate_hostname(hostname)\n      hostname\n    end\n\n    def self.validate_network(network)\n      validate_ip(network)\n    end\n\n    def self.validate_network!(network)\n      raise(Error, \"Invalid Network #{network}\") unless validate_network(network)\n      network\n    end\n\n    # ensures that the ip address does not contain any leading spaces or invalid strings\n    def self.normalize_ip(ip)\n      return unless ip.present?\n      return ip unless ip =~ IP_REGEXP\n      ip.split(\".\").map(&:to_i).join(\".\")\n    end","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/lib/net/validations.rb#L80-L116","documentation":"Error \"Invalid hostname #{hostname}\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/lib/net/validations.rb:98 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"}