{"record":{"id":"abe11a5531fa1cab","repo":"kestra-io/kestra","slug":"the-isdayweekinmonth-function-expects-a-dayof","errorCode":null,"errorMessage":"The 'isDayWeekInMonth()' function expects a 'dayOfWeek' argument.","messagePattern":"The 'isDayWeekInMonth\\(\\)' function expects a 'dayOfWeek' argument\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"critical","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java","lineNumber":43,"sourceCode":" *\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());\n        } catch (IllegalArgumentException e) {\n            throw new PebbleException(\n                e,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java#L25-L61","documentation":"The isDayWeekInMonth() function requires three arguments — date, dayOfWeek, position. This fires when dayOfWeek is null or missing.","triggerScenarios":"Calling isDayWeekInMonth(date='2024-01-15', position='FIRST') without dayOfWeek.","commonSituations":"Omitted argument, or a templated dayOfWeek that resolved to null.","solutions":["Pass a valid day name as dayOfWeek (e.g. dayOfWeek='MONDAY').","Guard templated values before calling."],"exampleFix":"// before\n{{ isDayWeekInMonth(date='2024-01-15', position='FIRST') }}\n// after\n{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position='FIRST') }}","handlingStrategy":"validation","validationCode":"{% if myDay is not empty %}{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek=myDay, position='FIRST') }}{% endif %}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass all three arguments (date, dayOfWeek, position).","Guard templated dayOfWeek values with 'is not empty' before calling."],"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"}