{"record":{"id":"42733ea85fe6006e","repo":"kestra-io/kestra","slug":"the-isdayweekinmonth-function-expects-a-date","errorCode":null,"errorMessage":"The 'isDayWeekInMonth()' function expects a 'date' argument.","messagePattern":"The 'isDayWeekInMonth\\(\\)' function expects a 'date' argument\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"critical","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java","lineNumber":40,"sourceCode":" * <ul>\n * <li>{@code {{ isDayWeekInMonth(date, dayOfWeek, position) }}}</li>\n * </ul>\n *\n * @param date any valid ISO 8601 date or datetime string\n * @param dayOfWeek day of the week (e.g. {@code \"MONDAY\"}, {@code \"FRIDAY\"})\n * @param position occurrence within the month: {@code FIRST}, {@code SECOND}, {@code THIRD}, {@code FOURTH}, or {@code LAST}\n */\npublic class IsDayWeekInMonthFunction implements KestraFunction {\n    public static final String NAME = \"isDayWeekInMonth\";\n\n    @Override\n    public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {\n        Object dateArg = args.get(\"date\");\n        Object dayOfWeekArg = args.get(\"dayOfWeek\");\n        Object positionArg = args.get(\"position\");\n\n        if (dateArg == null) {\n            throw new PebbleException(null, \"The 'isDayWeekInMonth()' function expects a 'date' argument.\", lineNumber, self.getName());\n        }\n        if (dayOfWeekArg == null) {\n            throw new PebbleException(null, \"The 'isDayWeekInMonth()' function expects a 'dayOfWeek' argument.\", lineNumber, self.getName());\n        }\n        if (positionArg == null) {\n            throw new PebbleException(null, \"The 'isDayWeekInMonth()' function expects a 'position' argument.\", lineNumber, self.getName());\n        }\n\n        LocalDate localDate;\n        try {\n            localDate = DateUtils.parseLocalDate(dateArg.toString());\n        } catch (InternalException e) {\n            throw new PebbleException(e, \"The 'isDayWeekInMonth()' function could not parse 'date': \" + e.getMessage(), lineNumber, self.getName());\n        }\n\n        DayOfWeek dayOfWeek;\n        try {\n            dayOfWeek = DayOfWeek.valueOf(dayOfWeekArg.toString().toUpperCase());","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java#L22-L58","documentation":"The isDayWeekInMonth() function requires three arguments — date, dayOfWeek, position. This fires when date is null or missing.","triggerScenarios":"Calling isDayWeekInMonth(dayOfWeek='MONDAY', position='FIRST') without a date, or with a date variable that resolved to null.","commonSituations":"Referencing an output that is not set, or positional misuse of the arguments.","solutions":["Pass a valid ISO date string as date (e.g. isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position='FIRST')).","Guard templated date values with 'is not empty' before calling."],"exampleFix":"// before\n{{ isDayWeekInMonth(dayOfWeek='MONDAY', position='FIRST') }}\n// after\n{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position='FIRST') }}","handlingStrategy":"validation","validationCode":"{% if myDate is not empty %}{{ isDayWeekInMonth(date=myDate, dayOfWeek='MONDAY', position='FIRST') }}{% endif %}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass all three arguments (date, dayOfWeek, position) to isDayWeekInMonth.","Guard templated date values with 'is not empty' before calling.","Treat a missing required argument as a template bug."],"tags":["pebble","date","argument","required-arg"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}