{"record":{"id":"e9a76cbedbeabfb4","repo":"kestra-io/kestra","slug":"failed-to-execute-http-request","errorCode":null,"errorMessage":"Failed to execute HTTP request ","messagePattern":"Failed to execute HTTP request ","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/HttpFunction.java","lineNumber":112,"sourceCode":"        }\n\n        UriBuilder uriWithQueryBuilder = UriBuilder.of(uri);\n        query.forEach(uriWithQueryBuilder::queryParam);\n\n        HttpRequest httpRequest = HttpRequest.of(uriWithQueryBuilder.build(), method, body, headers);\n        HttpConfiguration httpConfiguration = Optional.ofNullable(args.get(\"options\"))\n            .map(o -> JacksonMapper.toMap(o, HttpConfiguration.class))\n            .orElse(null);\n\n        try (HttpClient httpClient = new HttpClient(runContext, httpConfiguration)) {\n            HttpResponse<Object> response = httpClient.request(httpRequest, Object.class);\n            return response.getBody();\n        } catch (HttpClientResponseException e) {\n            if (e.getResponse() != null) {\n                String msg = \"Failed to execute HTTP Request, server respond with status \" + e.getResponse().getStatus().getCode() + \" : \" + e.getResponse().getStatus().getReason();\n                throw new PebbleException(e, msg, lineNumber, self.getName());\n            } else {\n                throw new PebbleException(e, \"Failed to execute HTTP request \", lineNumber, self.getName());\n            }\n        } catch (HttpClientException | IllegalVariableEvaluationException | IOException e) {\n            throw new PebbleException(e, \"Failed to execute HTTP request \", lineNumber, self.getName());\n        }\n    }\n\n    private Map<String, List<String>> singleValueToListForHeaders(Map<String, Object> m) {\n        return m.entrySet().stream()\n            .map(e -> Map.entry(e.getKey(), e.getValue() instanceof String valueStr ? List.of(valueStr) : (List<String>) e.getValue()))\n            .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));\n    }\n\n    private HttpRequest.RequestBody toRequestBody(Map<String, Object> args, PebbleTemplate self, int lineNumber, String contentType) {\n        HttpRequest.RequestBody body;\n        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n        Class<T> bodyClass = (Class<T>) args.get(\"body\").getClass();\n        MessageBodyWriter<T> bodyWriter = defaultMessageBodyHandlerRegistry.findWriter(Argument.of(bodyClass), MediaType.of(contentType)).orElse(FALLBACK_CONTENT_WRITER);\n        bodyWriter.writeTo(Argument.of(bodyClass), MediaType.of(contentType), (T) args.get(\"body\"), new SimpleHttpHeaders(), byteArrayOutputStream);","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/HttpFunction.java#L94-L130","documentation":"Thrown when the 'http' function catches an HttpClientResponseException but that exception carries no response object. This is an edge case where the client failed in a way that produced a response-style exception without the actual response payload, so the status code and reason cannot be reported.","triggerScenarios":"A response exception raised before or without the response being fully received — e.g. the client aborted during response parsing, or an HttpClient code path that constructs HttpClientResponseException without a response.","commonSituations":"Connection dropped mid-response, a malformed response that the client rejected before populating the response object, or an exotic redirect/proxy error.","solutions":["Inspect the wrapped exception's cause (the original PebbleException getCause()) for the real failure reason.","Enable DEBUG logging on io.kestra.core.http to capture the raw exchange.","Check proxies, TLS interception, and intermediate gateways on the path to the host.","Reproduce with a standalone HTTP call to see whether the server or proxy is at fault."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Wrap the call so a connection-drop does not fail the whole flow\nerrors:\n  - id: on_http_failure\n    type: io.kestra.plugin.core.log.Log\n    message: \"HTTP exchange failed without a response; retrying\"","preventionTips":["Add retry logic for transient connection drops.","Verify the network path and proxy configuration to the target host.","Enable DEBUG on io.kestra.core.http when the failure is intermittent."],"tags":["pebble","http","network","edge-case"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}