kestra-io/kestra · critical · PebbleException
The 'isLastWorkingDay()' function expects a 'date' argument.
Error message
The 'isLastWorkingDay()' function expects a 'date' argument.
What it means
The isLastWorkingDay() 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/IsLastWorkingDayFunction.java:49
* </ul>
*
* @param date any valid ISO 8601 date or datetime string
* @param workingDays optional comma- or space-separated list of day names (e.g. {@code "MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY"})
*/
public class IsLastWorkingDayFunction implements KestraFunction {
public static final String NAME = "isLastWorkingDay";
private static final Set<DayOfWeek> DEFAULT_WORKING_DAYS = EnumSet.of(
DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY,
DayOfWeek.THURSDAY, DayOfWeek.FRIDAY
);
@Override
public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
Object dateArg = args.get("date");
if (dateArg == null) {
throw new PebbleException(null, "The 'isLastWorkingDay()' function expects a 'date' argument.", lineNumber, self.getName());
}
LocalDate localDate;
try {
localDate = DateUtils.parseLocalDate(dateArg.toString());
} catch (InternalException e) {
throw new PebbleException(e, "The 'isLastWorkingDay()' function could not parse 'date': " + e.getMessage(), lineNumber, self.getName());
}
Set<DayOfWeek> workingDays = resolveWorkingDays(args.get("workingDays"), self, lineNumber);
if (!workingDays.contains(localDate.getDayOfWeek())) {
return false;
}
// Walk backwards from the last calendar day of the month to find the last working day
LocalDate lastOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth());
LocalDate candidate = lastOfMonth;View on GitHub (pinned to 823fada927)
Solutions
- Pass a valid ISO date string as date (e.g. isLastWorkingDay(date='2024-01-31')).
- Guard templated date values with 'is not empty' before calling.
Example fix
// before
{{ isLastWorkingDay() }}
// after
{{ isLastWorkingDay(date='2024-01-31') }} Defensive patterns
Strategy: validation
Validate before calling
{% if myDate is not empty %}{{ isLastWorkingDay(date=myDate) }}{% endif %} Prevention
- Always pass a date argument to isLastWorkingDay.
- Guard templated date values with 'is not empty' before calling.
When it happens
Trigger: Calling isLastWorkingDay() with no arguments, 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 'isPublicHoliday()' function expects a 'date' argument.
- The 'dayOfMonth()' function expects a 'date' argument.
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/8f630ace0fc05af0.
Report an issue: GitHub.