{"record":{"id":"26deb109bf41df89","repo":"theforeman/foreman","slug":"unable-to-retrieve-the-next-available-ip-for-subne","errorCode":null,"errorMessage":"Unable to retrieve the next available IP for subnet %{subnet} External IPAM.","messagePattern":"Unable to retrieve the next available IP for subnet %(.+?) External IPAM\\.","errorType":"exception","errorClass":"ProxyException","httpStatus":null,"severity":"error","filePath":"app/services/proxy_api/external_ipam.rb","lineNumber":70,"sourceCode":"    # Responses:\n    #   Responses if success:\n    #     IPv4: {\"data\": \"100.55.55.3\"}\n    #     IPv6: {\"data\": \"2001:db8:abcd:12::1\"}\n    #   Response if missing required params:\n    #     {\"error\": [\"A 'cidr' parameter for the subnet must be provided(e.g. 100.10.10.0/24)\",\"A 'mac' address must be provided(e.g. 00:0a:95:9d:68:10)\"]}\n    #   Response if subnet does not exist:\n    #     {\"error\": \"Subnet not found in External IPAM.\"}\n    #   Response if there are no free addresses:\n    #     {\"error\": \"No free addresses found\"}\n    #   Response if can't connect to External IPAM server\n    #     {\"error\": \"Unable to connect to External IPAM server\"}\n    def next_ip(subnet, mac, group = \"\")\n      raise \"subnet cannot be nil\" if subnet.nil?\n      response = parse get(\"/subnet/#{subnet}/next_ip\", query: { mac: mac, group: group })\n      raise(response['error']) if response['error'].present?\n      response['data']\n    rescue => e\n      raise ProxyException.new(url, e, N_(\"Unable to retrieve the next available IP for subnet %{subnet} External IPAM.\"), subnet: subnet)\n    end\n\n    # Adds an IP address to the specified subnet in External IPAM. This will reserve the IP in the\n    # External IPAM database. If group is specified, the IP will be added to the subnet within the\n    # given group.\n    #\n    # Params: 1. ip:               IP address to be added\n    #         2. subnet:           The IPv4 or IPv6 subnet CIDR. (Examples: IPv4 - \"100.10.10.0/24\",\n    #                              IPv6 - \"2001:db8:abcd:12::/124\")\n    #         3. group(optional):  The name of the External IPAM group containing the subnet.\n    #\n    # Returns: true if IP was added successfully to External IPAM, otherwise false\n    #\n    # Responses:\"\n    #   Response if success:\n    #     201\n    #   Response if IP already reserved:\n    #     {\"error\": \"IP address already exists\"}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/proxy_api/external_ipam.rb#L52-L88","documentation":"Error \"Unable to retrieve the next available IP for subnet %{subnet} External IPAM.\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/proxy_api/external_ipam.rb:70 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"}