{"record":{"id":"10f998df448c42af","repo":"conductor-oss/conductor","slug":"error-making-an-http-call-reasonphrase-status","errorCode":null,"errorMessage":"Error making an HTTP call {reasonPhrase}, status: {statusCode}","messagePattern":"Error making an HTTP call (.+?), status: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/document/HttpDocumentLoader.java","lineNumber":198,"sourceCode":"        try (Response response = httpClient.newCall(requestBuilder.build()).execute()) {\n            HttpResponse httpResponse = new HttpResponse();\n            httpResponse.statusCode = response.code();\n            httpResponse.reasonPhrase = response.message();\n\n            // Convert OkHttp headers to Spring HttpHeaders for compatibility\n            org.springframework.http.HttpHeaders springHeaders =\n                    new org.springframework.http.HttpHeaders();\n            response.headers().toMultimap().forEach(springHeaders::addAll);\n            httpResponse.headers = springHeaders;\n\n            // Read response body\n            if (response.body() != null) {\n                httpResponse.body = response.body().bytes();\n            }\n\n            // Check for errors\n            if (!response.isSuccessful()) {\n                throw new RuntimeException(\n                        \"Error making an HTTP call \"\n                                + httpResponse.reasonPhrase\n                                + \", status: \"\n                                + httpResponse.statusCode);\n            }\n\n            return httpResponse;\n        }\n    }\n\n    /** Create RequestBody from the input body object. */\n    private RequestBody createRequestBody(Object body, String contentType) {\n        if (body == null) {\n            return RequestBody.create(new byte[0], null);\n        }\n\n        MediaType mediaType =\n                contentType != null","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/document/HttpDocumentLoader.java#L180-L216","documentation":"Thrown inside HttpDocumentLoader.httpCall when the OkHttp Response is not successful (!response.isSuccessful()). This is the generic per-call failure for any non-2xx status during a GET/POST/PUT/DELETE/PATCH made through the loader (the download path and the inner upload path both go through httpCall). Message includes reasonPhrase and statusCode. RuntimeException.","triggerScenarios":"Any HTTP call the loader makes returns a non-2xx status: server errors (5xx), client errors (4xx), redirects not auto-followed, etc. Connection-level failures (ConnectException/SocketException) are handled separately by retryOperation (up to 3 retries) and surface as a different wrapped throwable.","commonSituations":"Download endpoint returns 404/500; target service is temporarily unhealthy; a required header/query is missing causing 400; rate limiting (429).","solutions":["Read the statusCode/reasonPhrase to classify: 4xx -> fix request (URL/headers/auth), 5xx/429 -> retry after backoff or wait.","Verify the URL and any auth headers are correct for the target service.","For transient 5xx, note the loader only retries ConnectException/SocketException — HTTP-level 5xx is NOT retried, so wrap the call in your own retry for those.","Check the target service health/logs if 5xx persists."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate the URL is reachable-shaped before the call (does not guarantee success)\njava.net.URI u = java.net.URI.create(location);\nif (u.getHost() == null) throw new IllegalArgumentException(\"Invalid URL: \" + location);","typeGuard":null,"tryCatchPattern":"// The loader only retries ConnectException/SocketException; add your own retry for HTTP 5xx\nint attempt = 0;\nwhile (true) {\n    try {\n        return loader.download(location);\n    } catch (RuntimeException e) {\n        if (++attempt >= MAX_ATTEMPTS || !isTransient(e)) throw e;\n        backoff(attempt);\n    }\n}","preventionTips":["Verify URL and auth headers are correct for the target before the call.","Remember HTTP 5xx is not auto-retried by the loader — add an outer retry for transient server errors.","Check target service health when 5xx persists."],"tags":["document-loader","http","okhttp","download","runtimeexception"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}