kestra-io/kestra · error · PebbleException
The 'isLastWorkingDay()' function requires at least one vali
Error message
The 'isLastWorkingDay()' function requires at least one valid day in 'workingDays'.
What it means
After splitting workingDays, every token was empty/blank, so the resulting day set is empty. The string was non-blank (so it bypassed the default Mon–Fri shortcut) but contained only separators/whitespace.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/IsLastWorkingDayFunction.java:99
Set<DayOfWeek> result = EnumSet.noneOf(DayOfWeek.class);
for (String part : parts) {
String trimmed = part.trim();
if (trimmed.isEmpty()) {
continue;
}
try {
result.add(DayOfWeek.valueOf(trimmed.toUpperCase()));
} catch (IllegalArgumentException e) {
throw new PebbleException(
e,
"The 'isLastWorkingDay()' function received an invalid 'workingDays' value: '" + trimmed + "'. Expected day names like MONDAY, TUESDAY, etc.",
lineNumber, self.getName()
);
}
}
if (result.isEmpty()) {
throw new PebbleException(null, "The 'isLastWorkingDay()' function requires at least one valid day in 'workingDays'.", lineNumber, self.getName());
}
return result;
}
@Override
public List<String> getArgumentNames() {
return List.of("date", "workingDays");
}
@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() {
HashMap<String, String> defaults = new HashMap<>();
defaults.put("date", null);
defaults.put("workingDays", null);
return defaults;View on GitHub (pinned to 823fada927)
Solutions
- Provide at least one valid day name, or omit workingDays to use the default Mon–Fri.
- Sanitize templated workingDays values before passing.
Example fix
// before
{{ isLastWorkingDay(date='2024-01-31', workingDays=',,') }}
// after
{{ isLastWorkingDay(date='2024-01-31', workingDays='MONDAY') }} Defensive patterns
Strategy: validation
Validate before calling
{% set days = workingDays ?? '' %}{% if days|replace({',': '', ' ': ''}) is empty %}{% set days = null %}{% endif %}{{ isLastWorkingDay(date=myDate, workingDays=days) }} Prevention
- Provide at least one valid day name in workingDays, or omit it to use the default.
- Sanitize templated workingDays values so they are not just delimiters/whitespace.
When it happens
Trigger: Passing workingDays=',' , ' , ,' , or any value that consists only of delimiters and whitespace tokens.
Common situations: A templated workingDays value that rendered to separators only, or a copy-paste artifact.
Related errors
- The 'isDayWeekInMonth()' function received an invalid 'dayOf
- The 'isDayWeekInMonth()' function received an invalid 'posit
- The 'isLastWorkingDay()' function received an invalid 'worki
- The 'hourOfDay()' function expects a 'date' argument.
- The 'hourOfDay()' function could not parse 'date': {e2.getMe
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/3fb2122592491993.
Report an issue: GitHub.