kestra-io/kestra · error · PebbleException
The 'isPublicHoliday()' function could not parse 'date': {e.
Error message
The 'isPublicHoliday()' function could not parse 'date': {e.getMessage()} What it means
The Pebble function isPublicHoliday(date, countryCode, subDivision) calls DateUtils.parseLocalDate on the date argument, which only accepts ISO 8601 formats (yyyy-MM-dd, yyyy-MM-ddTHH:mm:ss, or a full ZonedDateTime like 2024-01-01T00:00:00+01:00[Europe/Paris]). When parsing fails through all three internal fallback paths, the resulting InternalException is wrapped in this PebbleException. The underlying cause message from the DateTimeException is appended.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/IsPublicHolidayFunction.java:61
Object subDivisionArg = args.get("subDivision");
if (dateArg == null) {
throw new PebbleException(null, "The 'isPublicHoliday()' function expects a 'date' argument.", lineNumber, self.getName());
}
if (countryCodeArg == null) {
throw new PebbleException(null, "The 'isPublicHoliday()' function expects a 'countryCode' argument.", lineNumber, self.getName());
}
String countryCode = countryCodeArg.toString();
String subDivision = subDivisionArg != null && !subDivisionArg.toString().isBlank()
? subDivisionArg.toString()
: null;
LocalDate localDate;
try {
localDate = DateUtils.parseLocalDate(dateArg.toString());
} catch (InternalException e) {
throw new PebbleException(e, "The 'isPublicHoliday()' function could not parse 'date': " + e.getMessage(), lineNumber, self.getName());
}
HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(countryCode));
return subDivision == null
? holidayManager.isHoliday(localDate)
: holidayManager.isHoliday(localDate, subDivision);
}
@Override
public List<String> getArgumentNames() {
return List.of("date", "countryCode", "subDivision");
}
@Override
// HashMap is required here because Map.of() does not allow null values,
// and null defaults indicate arguments with no meaningful autocompletion default.
public Map<String, String> getArgumentDefaults() {View on GitHub (pinned to 823fada927)
Solutions
- Convert the date to ISO 8601 (yyyy-MM-dd) before calling isPublicHoliday — e.g. use a date formatting expression or the formatDate function upstream.
- If the date comes from an external source, add a transform task that normalizes it to yyyy-MM-dd.
- Inspect the appended e.getMessage() to see the exact format the parser expected versus received.
Example fix
# before
value: "{{ isPublicHoliday('15/01/2024', 'FR') }}"
# after
value: "{{ isPublicHoliday('2024-01-15', 'FR') }}" Defensive patterns
Strategy: validation
Validate before calling
# In the Pebble template, validate the date is ISO 8601 before calling:
# Ensure the variable is a string matching yyyy-MM-dd pattern
{% set datePattern = /^\d{4}-\d{2}-\d{2}$/ %}
{% if dateVar matches datePattern %}
{{ isPublicHoliday(dateVar, countryCode) }}
{% else %}
{{ throw('date must be ISO 8601 (yyyy-MM-dd)') }}
{% endif %} Prevention
- Always pass dates in yyyy-MM-dd format from upstream tasks.
- Use a date-formatting expression to normalize dates from external sources before passing to isPublicHoliday.
- Test Pebble expressions with sample data in the Kestra UI before deploying.
When it happens
Trigger: Passing a date string that is not ISO 8601 (e.g. '01/15/2024', 'Jan 15 2024', '15-01-2024'); passing a variable that resolves to a non-date string; passing a timestamp in epoch seconds or a locale-formatted string produced by an upstream task or external API.
Common situations: An upstream task outputs a date in a regional format (US-style MM/DD/YYYY or European DD-MM-YYYY). A third-party API returns dates in a non-ISO format. A user assumes the function accepts any human-readable date string.
Related errors
- The 'isWeekend()' function could not parse 'date': {e.getMes
- The 'monthOfYear()' function could not parse 'date': %s
- The 'isWeekend()' function expects a 'date' argument.
- {e.getMessage()}
- The key '{key}' does not exist in the namespace '{namespace}
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/bf43c700aa10abf3.
Report an issue: GitHub.