kestra-io/kestra · critical · PebbleException
The 'isPublicHoliday()' function expects a 'date' argument.
Error message
The 'isPublicHoliday()' function expects a 'date' argument.
What it means
The isPublicHoliday() function requires a 'date' argument. This fires when date is null or missing.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/IsPublicHolidayFunction.java:46
* <li>{@code {{ isPublicHoliday(date, countryCode) }}}</li>
* <li>{@code {{ isPublicHoliday(date, countryCode, subDivision) }}}</li>
* </ul>
*
* @param date any valid ISO 8601 date or datetime string
* @param countryCode ISO 3166-1 alpha-2 country code (e.g. {@code "FR"})
* @param subDivision optional ISO 3166-2 sub-division code (e.g. {@code "IDF"})
*/
public class IsPublicHolidayFunction implements KestraFunction {
public static final String NAME = "isPublicHoliday";
@Override
public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
Object dateArg = args.get("date");
Object countryCodeArg = args.get("countryCode");
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));View on GitHub (pinned to 823fada927)
Solutions
- Pass a valid ISO date string as date (e.g. isPublicHoliday(date='2024-07-14', countryCode='FR')).
- Guard templated date values with 'is not empty' before calling.
Example fix
// before
{{ isPublicHoliday(countryCode='FR') }}
// after
{{ isPublicHoliday(date='2024-07-14', countryCode='FR') }} Defensive patterns
Strategy: validation
Validate before calling
{% if myDate is not empty %}{{ isPublicHoliday(date=myDate, countryCode='FR') }}{% endif %} Prevention
- Always pass a date argument to isPublicHoliday.
- Guard templated date values with 'is not empty' before calling.
When it happens
Trigger: Calling isPublicHoliday(countryCode='FR') without date, or with a date variable that resolved to null.
Common situations: Referencing an output that is not set, or forgetting the date argument.
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 'countryCode' arg
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/6339d626d066e584.
Report an issue: GitHub.