{"record":{"id":"7b3c26ceb94bb69b","repo":"theforeman/foreman","slug":"unable-to-add-ip-ip-to-the-subnet-subnet-in","errorCode":null,"errorMessage":"Unable to add IP %{ip} to the subnet %{subnet} in External IPAM.","messagePattern":"Unable to add IP %(.+?) to the subnet %(.+?) in External IPAM\\.","errorType":"exception","errorClass":"ProxyException","httpStatus":null,"severity":"error","filePath":"app/services/proxy_api/external_ipam.rb","lineNumber":102,"sourceCode":"    # Responses:\"\n    #   Response if success:\n    #     201\n    #   Response if IP already reserved:\n    #     {\"error\": \"IP address already exists\"}\n    #   Response if subnet error:\n    #     {\"error\": \"Subnet not found in External IPAM\"}\n    #   Response if missing required params:\n    #     {\"error\": [\"A 'cidr' parameter for the subnet must be provided(e.g. 100.10.10.0/24)\",\"Missing 'ip' parameter. An IPv4 address must be provided(e.g. 100.10.10.22)\"]}\n    #   Response if can't connect to External IPAM server\n    #     {\"error\": \"Unable to connect to External IPAM server\"}\n    def add_ip_to_subnet(ip, subnet, group = \"\")\n      raise \"subnet cannot be nil\" if subnet.nil?\n      raise \"ip cannot be nil\" if ip.nil?\n      response = parse post({}, \"/subnet/#{subnet}/#{ip}?group=#{CGI.escape(group.to_s)}\")\n      raise(response['error']) if response.is_a?(Hash) && response['error'].present?\n      response\n    rescue => e\n      raise ProxyException.new(url, e, N_(\"Unable to add IP %{ip} to the subnet %{subnet} in External IPAM.\"), ip: ip, subnet: subnet)\n    end\n\n    # Get a list of groups from External IPAM. A group is a logical grouping of subnets/ips.\n    #\n    # Params:  None\n    #\n    # Returns: An array of groups on success, or a hash with a \"error\" key\n    #          containing error on failure.\n    #\n    # Responses:\n    #   Response if success:\n    #     {[\n    #       {name\":\"Test Group\",\"description\": \"A Test Group\"},\n    #       {name\":\"Awesome Group\",\"description\": \"A totally awesome Group\"}\n    #     ]}\n    #   Response if no groups exist:\n    #     []\n    #   Response if groups are not supported:","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/proxy_api/external_ipam.rb#L84-L120","documentation":"Error \"Unable to add IP %{ip} to the subnet %{subnet} in External IPAM.\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/proxy_api/external_ipam.rb:102 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"}