kestra-io/kestra · error · PebbleException
Failed to execute HTTP request
Error message
Failed to execute HTTP request
What it means
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.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/HttpFunction.java:112
}
UriBuilder uriWithQueryBuilder = UriBuilder.of(uri);
query.forEach(uriWithQueryBuilder::queryParam);
HttpRequest httpRequest = HttpRequest.of(uriWithQueryBuilder.build(), method, body, headers);
HttpConfiguration httpConfiguration = Optional.ofNullable(args.get("options"))
.map(o -> JacksonMapper.toMap(o, HttpConfiguration.class))
.orElse(null);
try (HttpClient httpClient = new HttpClient(runContext, httpConfiguration)) {
HttpResponse<Object> response = httpClient.request(httpRequest, Object.class);
return response.getBody();
} catch (HttpClientResponseException e) {
if (e.getResponse() != null) {
String msg = "Failed to execute HTTP Request, server respond with status " + e.getResponse().getStatus().getCode() + " : " + e.getResponse().getStatus().getReason();
throw new PebbleException(e, msg, lineNumber, self.getName());
} else {
throw new PebbleException(e, "Failed to execute HTTP request ", lineNumber, self.getName());
}
} catch (HttpClientException | IllegalVariableEvaluationException | IOException e) {
throw new PebbleException(e, "Failed to execute HTTP request ", lineNumber, self.getName());
}
}
private Map<String, List<String>> singleValueToListForHeaders(Map<String, Object> m) {
return m.entrySet().stream()
.map(e -> Map.entry(e.getKey(), e.getValue() instanceof String valueStr ? List.of(valueStr) : (List<String>) e.getValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
private HttpRequest.RequestBody toRequestBody(Map<String, Object> args, PebbleTemplate self, int lineNumber, String contentType) {
HttpRequest.RequestBody body;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
Class<T> bodyClass = (Class<T>) args.get("body").getClass();
MessageBodyWriter<T> bodyWriter = defaultMessageBodyHandlerRegistry.findWriter(Argument.of(bodyClass), MediaType.of(contentType)).orElse(FALLBACK_CONTENT_WRITER);
bodyWriter.writeTo(Argument.of(bodyClass), MediaType.of(contentType), (T) args.get("body"), new SimpleHttpHeaders(), byteArrayOutputStream);View on GitHub (pinned to 823fada927)
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.
Defensive patterns
Strategy: retry
Try / catch
# Wrap the call so a connection-drop does not fail the whole flow
errors:
- id: on_http_failure
type: io.kestra.plugin.core.log.Log
message: "HTTP exchange failed without a response; retrying" Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Connection dropped mid-response, a malformed response that the client rejected before populating the response object, or an exotic redirect/proxy error.
Related errors
- Failed to execute HTTP Request, server respond with status {
- Couldn't write the request body as YAML
- Unsupported content type
- Couldn't parse the request body
- The 'http' function expects an argument 'uri'.
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/e9a76cbedbeabfb4.
Report an issue: GitHub.