kestra-io/kestra · error · PebbleException

The 'isDayWeekInMonth()' function could not parse 'date': {e

Error message

The 'isDayWeekInMonth()' function could not parse 'date': {e.getMessage()}

What it means

isDayWeekInMonth() could not parse the date argument with DateUtils.parseLocalDate; the value is not a recognizable ISO 8601 date or datetime. The wrapped InternalException message gives the parse detail.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java:53

        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,
                "The 'isDayWeekInMonth()' function received an invalid 'dayOfWeek' value: '" + dayOfWeekArg
                    + "'. Expected one of: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.",
                lineNumber, self.getName()
            );
        }

        LocalDate computed = switch (positionArg.toString().toUpperCase()) {
            case "FIRST" -> localDate.with(TemporalAdjusters.firstInMonth(dayOfWeek));
            case "SECOND" -> localDate.with(TemporalAdjusters.firstInMonth(dayOfWeek)).plusWeeks(1);
            case "THIRD" -> localDate.with(TemporalAdjusters.firstInMonth(dayOfWeek)).plusWeeks(2);

View on GitHub (pinned to 823fada927)

Solutions

  1. Provide an ISO 8601 date ('YYYY-MM-DD') or datetime ('YYYY-MM-DDTHH:mm:ss').
  2. Pre-format the date before passing, e.g. with a date filter.
  3. Inspect the appended parse error message for the exact failure.

Example fix

// before
{{ isDayWeekInMonth(date='15/01/2024', dayOfWeek='MONDAY', position='FIRST') }}
// after
{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position='FIRST') }}
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Passing date like '2024-13-01' (invalid month), '01/15/2024' (US order, slashes), 'tomorrow', or an empty/blank string.

Common situations: Locale-specific date formats (DD/MM/YYYY or MM/DD/YYYY), relative words, or a templated value that rendered to something unexpected.

Related errors


AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14). Data as JSON: /api/errors/a8457128d681d0fb. Report an issue: GitHub.