kestra-io/kestra · critical · PebbleException
The 'http' function expects an argument 'uri'.
Error message
The 'http' function expects an argument 'uri'.
What it means
The 'http' Pebble function requires a 'uri' argument; this is thrown up-front by throwIfMissingArgs when uri is not present in the call.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/HttpFunction.java:143
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);
try {
body = HttpRequest.RequestBody.from(
new ByteArrayEntity(byteArrayOutputStream.toByteArray(), ContentType.create(contentType))
);
} catch (IOException e) {
throw new PebbleException(e, "Couldn't parse the request body", lineNumber, self.getName());
}
return body;
}
private void throwIfMissingArgs(Map<String, Object> args, PebbleTemplate self, int lineNumber) {
if (!args.containsKey("uri")) {
throw new PebbleException(null, "The 'http' function expects an argument 'uri'.", lineNumber, self.getName());
}
}
@Override
public List<String> getArgumentNames() {
return List.of("uri", "method", "query", "body", "contentType", "headers", "options", "accept");
}
@Override
public Map<String, String> getArgumentDefaults() {
HashMap<String, String> defaults = new HashMap<>();
defaults.put("uri", "'https://example.com'");
defaults.put("method", "'GET'");
defaults.put("query", null);
defaults.put("body", null);
defaults.put("contentType", null);
defaults.put("headers", null);
defaults.put("options", null);View on GitHub (pinned to 823fada927)
Solutions
- Pass a uri argument, e.g. http('https://example.com') or http(uri=...).
- If uri is templated, ensure the expression resolves to a non-null string or URI before the call.
Example fix
// before
{{ http(method='GET') }}
// after
{{ http('https://example.com', method='GET') }} Defensive patterns
Strategy: validation
Validate before calling
{% if myUri is not empty %}{{ http(myUri) }}{% endif %} Prevention
- Always pass uri as the first positional argument or as an explicit named arg.
- Guard templated uris with 'is not empty' before calling.
- Treat a missing uri as a template bug and fix it at the source.
When it happens
Trigger: Calling http() with no arguments, or only named arguments that omit uri (e.g. http(method='GET')).
Common situations: Forgot the uri, or referenced a variable for uri that resolved to null so the key was never set.
Related errors
- The 'isDayWeekInMonth()' function expects a 'date' argument.
- The 'isDayWeekInMonth()' function expects a 'dayOfWeek' argu
- The 'isDayWeekInMonth()' function expects a 'position' argum
- The 'isLastWorkingDay()' function expects a 'date' argument.
- The 'isPublicHoliday()' function expects a 'date' argument.
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/8a18e191c133b7e5.
Report an issue: GitHub.