kestra-io/kestra · critical · PebbleException
The 'isDayWeekInMonth()' function expects a 'dayOfWeek' argu
Error message
The 'isDayWeekInMonth()' function expects a 'dayOfWeek' argument.
What it means
The isDayWeekInMonth() function requires three arguments — date, dayOfWeek, position. This fires when dayOfWeek is null or missing.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java:43
*
* @param date any valid ISO 8601 date or datetime string
* @param dayOfWeek day of the week (e.g. {@code "MONDAY"}, {@code "FRIDAY"})
* @param position occurrence within the month: {@code FIRST}, {@code SECOND}, {@code THIRD}, {@code FOURTH}, or {@code LAST}
*/
public class IsDayWeekInMonthFunction implements KestraFunction {
public static final String NAME = "isDayWeekInMonth";
@Override
public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
Object dateArg = args.get("date");
Object dayOfWeekArg = args.get("dayOfWeek");
Object positionArg = args.get("position");
if (dateArg == null) {
throw new PebbleException(null, "The 'isDayWeekInMonth()' function expects a 'date' argument.", lineNumber, self.getName());
}
if (dayOfWeekArg == null) {
throw new PebbleException(null, "The 'isDayWeekInMonth()' function expects a 'dayOfWeek' argument.", lineNumber, self.getName());
}
if (positionArg == null) {
throw new PebbleException(null, "The 'isDayWeekInMonth()' function expects a 'position' argument.", lineNumber, self.getName());
}
LocalDate localDate;
try {
localDate = DateUtils.parseLocalDate(dateArg.toString());
} catch (InternalException e) {
throw new PebbleException(e, "The 'isDayWeekInMonth()' function could not parse 'date': " + e.getMessage(), lineNumber, self.getName());
}
DayOfWeek dayOfWeek;
try {
dayOfWeek = DayOfWeek.valueOf(dayOfWeekArg.toString().toUpperCase());
} catch (IllegalArgumentException e) {
throw new PebbleException(
e,View on GitHub (pinned to 823fada927)
Solutions
- Pass a valid day name as dayOfWeek (e.g. dayOfWeek='MONDAY').
- Guard templated values before calling.
Example fix
// before
{{ isDayWeekInMonth(date='2024-01-15', position='FIRST') }}
// after
{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position='FIRST') }} Defensive patterns
Strategy: validation
Validate before calling
{% if myDay is not empty %}{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek=myDay, position='FIRST') }}{% endif %} Prevention
- Always pass all three arguments (date, dayOfWeek, position).
- Guard templated dayOfWeek values with 'is not empty' before calling.
When it happens
Trigger: Calling isDayWeekInMonth(date='2024-01-15', position='FIRST') without dayOfWeek.
Common situations: Omitted argument, or a templated dayOfWeek that resolved to null.
Related errors
- The 'isDayWeekInMonth()' function expects a 'date' argument.
- The 'isDayWeekInMonth()' function expects a 'position' argum
- The 'isLastWorkingDay()' function expects a 'date' argument.
- 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/abe11a5531fa1cab.
Report an issue: GitHub.