{"record":{"id":"bf43c700aa10abf3","repo":"kestra-io/kestra","slug":"the-ispublicholiday-function-could-not-parse","errorCode":null,"errorMessage":"The 'isPublicHoliday()' function could not parse 'date': {e.getMessage()}","messagePattern":"The 'isPublicHoliday\\(\\)' function could not parse 'date': (.+?)","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/IsPublicHolidayFunction.java","lineNumber":61,"sourceCode":"        Object subDivisionArg = args.get(\"subDivision\");\n\n        if (dateArg == null) {\n            throw new PebbleException(null, \"The 'isPublicHoliday()' function expects a 'date' argument.\", lineNumber, self.getName());\n        }\n        if (countryCodeArg == null) {\n            throw new PebbleException(null, \"The 'isPublicHoliday()' function expects a 'countryCode' argument.\", lineNumber, self.getName());\n        }\n\n        String countryCode = countryCodeArg.toString();\n        String subDivision = subDivisionArg != null && !subDivisionArg.toString().isBlank()\n            ? subDivisionArg.toString()\n            : null;\n\n        LocalDate localDate;\n        try {\n            localDate = DateUtils.parseLocalDate(dateArg.toString());\n        } catch (InternalException e) {\n            throw new PebbleException(e, \"The 'isPublicHoliday()' function could not parse 'date': \" + e.getMessage(), lineNumber, self.getName());\n        }\n\n        HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(countryCode));\n\n        return subDivision == null\n            ? holidayManager.isHoliday(localDate)\n            : holidayManager.isHoliday(localDate, subDivision);\n    }\n\n    @Override\n    public List<String> getArgumentNames() {\n        return List.of(\"date\", \"countryCode\", \"subDivision\");\n    }\n\n    @Override\n    // HashMap is required here because Map.of() does not allow null values,\n    // and null defaults indicate arguments with no meaningful autocompletion default.\n    public Map<String, String> getArgumentDefaults() {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/IsPublicHolidayFunction.java#L43-L79","documentation":"The Pebble function isPublicHoliday(date, countryCode, subDivision) calls DateUtils.parseLocalDate on the date argument, which only accepts ISO 8601 formats (yyyy-MM-dd, yyyy-MM-ddTHH:mm:ss, or a full ZonedDateTime like 2024-01-01T00:00:00+01:00[Europe/Paris]). When parsing fails through all three internal fallback paths, the resulting InternalException is wrapped in this PebbleException. The underlying cause message from the DateTimeException is appended.","triggerScenarios":"Passing a date string that is not ISO 8601 (e.g. '01/15/2024', 'Jan 15 2024', '15-01-2024'); passing a variable that resolves to a non-date string; passing a timestamp in epoch seconds or a locale-formatted string produced by an upstream task or external API.","commonSituations":"An upstream task outputs a date in a regional format (US-style MM/DD/YYYY or European DD-MM-YYYY). A third-party API returns dates in a non-ISO format. A user assumes the function accepts any human-readable date string.","solutions":["Convert the date to ISO 8601 (yyyy-MM-dd) before calling isPublicHoliday — e.g. use a date formatting expression or the formatDate function upstream.","If the date comes from an external source, add a transform task that normalizes it to yyyy-MM-dd.","Inspect the appended e.getMessage() to see the exact format the parser expected versus received."],"exampleFix":"# before\nvalue: \"{{ isPublicHoliday('15/01/2024', 'FR') }}\"\n# after\nvalue: \"{{ isPublicHoliday('2024-01-15', 'FR') }}\"","handlingStrategy":"validation","validationCode":"# In the Pebble template, validate the date is ISO 8601 before calling:\n# Ensure the variable is a string matching yyyy-MM-dd pattern\n{% set datePattern = /^\\d{4}-\\d{2}-\\d{2}$/ %}\n{% if dateVar matches datePattern %}\n  {{ isPublicHoliday(dateVar, countryCode) }}\n{% else %}\n  {{ throw('date must be ISO 8601 (yyyy-MM-dd)') }}\n{% endif %}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass dates in yyyy-MM-dd format from upstream tasks.","Use a date-formatting expression to normalize dates from external sources before passing to isPublicHoliday.","Test Pebble expressions with sample data in the Kestra UI before deploying."],"tags":["pebble-function","date-parsing","ispublicholiday"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}