{"record":{"id":"fa480f82a5ffc6f1","repo":"elastic/elasticsearch","slug":"error-during-downloading","errorCode":null,"errorMessage":"error during downloading {}","messagePattern":"error during downloading (.+?)","errorType":"http","errorClass":"ElasticsearchStatusException","httpStatus":null,"severity":"error","filePath":"modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/HttpClient.java","lineNumber":121,"sourceCode":"                    final URL base = new URL(innerUrl);\n                    final URL next = new URL(base, location);\n                    innerUrl = next.toExternalForm();\n\n                    // compare the *original* authority and the next authority to determine whether to include auth details.\n                    // this means that the host and port (if it is provided explicitly) are considered. it also means that if we\n                    // were to ping-pong back to the original authority, then we'd start including the auth details again.\n                    final String nextAuthority = next.getAuthority();\n                    if (originalAuthority.equals(nextAuthority)) {\n                        conn = createConnection(auth, innerUrl);\n                    } else {\n                        conn = createConnection(NO_AUTH, innerUrl);\n                    }\n                    break;\n                case HTTP_NOT_FOUND:\n                    throw new ResourceNotFoundException(\"{} not found\", url);\n                default:\n                    int responseCode = conn.getResponseCode();\n                    throw new ElasticsearchStatusException(\"error during downloading {}\", RestStatus.fromCode(responseCode), url);\n            }\n        }\n    }\n\n    @SuppressForbidden(reason = \"we need socket connection to download data from internet\")\n    private static InputStream getInputStream(final HttpURLConnection conn) throws IOException {\n        return conn.getInputStream();\n    }\n\n    private static HttpURLConnection createConnection(final PasswordAuthentication auth, final String url) throws IOException {\n        final HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();\n        if (auth != NO_AUTH) {\n            conn.setAuthenticator(new Authenticator() {\n                protected PasswordAuthentication getPasswordAuthentication() {\n                    return auth;\n                }\n            });\n        }","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ip-location/src/main/java/org/elasticsearch/ingest/geoip/HttpClient.java#L103-L139","documentation":"Thrown by HttpClient.get for any HTTP response code that is not 200, a redirect (301/302/303), or 404. It is an ElasticsearchStatusException whose RestStatus is derived from the actual response code, so 403, 429, 500, etc. each carry the correct status. This is the catch-all download failure for non-success, non-redirect, non-not-found responses.","triggerScenarios":"HttpClient.get switch default case -> throw new ElasticsearchStatusException(\"error during downloading {}\", RestStatus.fromCode(responseCode), url). Typical for 401/403 (auth), 429 (rate limit), 5xx (provider outage).","commonSituations":"Invalid/expired credentials (401/403); exceeding the provider rate limit or download quota (429); provider-side outage (5xx); geo-blocked IP returning 403; corporate proxy returning 502/504.","solutions":["Read the RestStatus in the exception: 401/403 -> fix credentials, 429 -> slow down / check quota, 5xx -> retry later.","For auth errors, update the license key/token in secure settings and reload.","For 429, reduce download frequency or confirm quota with the provider.","For 5xx, wait and retry; check the provider status page.","If a proxy returns 5xx, bypass or reconfigure it for the geoip host."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    InputStream in = httpClient.get(auth, url);\n} catch (ElasticsearchStatusException e) {\n    switch (e.status()) {\n        case UNAUTHORIZED, FORBIDDEN -> updateCredentialsAndReload();\n        case TOO_MANY_REQUESTS -> backoffAndRetry();\n        default -> { if (e.status().getStatus() >= 500) retryLater(); else throw e; }\n    }\n}","preventionTips":["Keep credentials valid and within quota.","Apply backoff for 429 responses rather than hammering the provider.","Bypass proxies that emit 5xx for the geoip host.","Map RestStatus to a retry/no-retry decision explicitly."],"tags":["geoip","http","download","network","auth"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}