kestra-io/kestra · critical · PebbleException
The 'isPublicHoliday()' function expects a 'countryCode' arg
Error message
The 'isPublicHoliday()' function expects a 'countryCode' argument.
What it means
The isPublicHoliday() function requires a 'countryCode' argument (ISO 3166-1 alpha-2); there is no locale-based fallback. This fires when countryCode is null or missing.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/IsPublicHolidayFunction.java:49
*
* @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));
return subDivision == null
? holidayManager.isHoliday(localDate)View on GitHub (pinned to 823fada927)
Solutions
- Pass an ISO 3166-1 alpha-2 country code, e.g. isPublicHoliday(date='2024-07-14', countryCode='FR').
- Optionally add a subDivision (ISO 3166-2) for regional holidays.
Example fix
// before
{{ isPublicHoliday(date='2024-07-14') }}
// after
{{ isPublicHoliday(date='2024-07-14', countryCode='FR') }} Defensive patterns
Strategy: validation
Validate before calling
{% if myCountry is not empty %}{{ isPublicHoliday(date=myDate, countryCode=myCountry) }}{% endif %} Prevention
- Always pass an ISO 3166-1 alpha-2 countryCode; there is no locale fallback.
- Guard templated countryCode values with 'is not empty' before calling.
- Use a subDivision (ISO 3166-2) only when you need regional holidays.
When it happens
Trigger: Calling isPublicHoliday(date='2024-07-14') without a countryCode.
Common situations: Assuming the country is inferred from the system locale or from the date.
Related errors
- The 'isPublicHoliday()' function expects a 'date' argument.
- 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.
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/8c4933ba20584265.
Report an issue: GitHub.