{"record":{"id":"b9211b733817e747","repo":"flowable/flowable-engine","slug":"the-given-variable-value-is-not-a-localdatetime","errorCode":null,"errorMessage":"The given variable value is not a localDateTime: '\" + result.getValue() + \"'","messagePattern":"The given variable value is not a localDateTime: '\" \\+ result\\.getValue\\(\\) \\+ \"'","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/LocalDateTimeRestVariableConverter.java","lineNumber":44,"sourceCode":"    public String getRestTypeName() {\n        return \"localDateTime\";\n    }\n\n    @Override\n    public Class<?> getVariableType() {\n        return LocalDateTime.class;\n    }\n\n    @Override\n    public Object getVariableValue(EngineRestVariable result) {\n        if (result.getValue() != null) {\n            if (!(result.getValue() instanceof String)) {\n                throw new FlowableIllegalArgumentException(\"Converter can only convert string to localDateTime\");\n            }\n            try {\n                return LocalDateTime.parse((String) result.getValue());\n            } catch (DateTimeParseException e) {\n                throw new FlowableIllegalArgumentException(\"The given variable value is not a localDateTime: '\" + result.getValue() + \"'\", e);\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public void convertVariableValue(Object variableValue, EngineRestVariable result) {\n        if (variableValue != null) {\n            if (!(variableValue instanceof LocalDateTime)) {\n                throw new FlowableIllegalArgumentException(\"Converter can only convert localDateTime\");\n            }\n            result.setValue(variableValue.toString());\n        } else {\n            result.setValue(null);\n        }\n    }\n\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/LocalDateTimeRestVariableConverter.java#L26-L62","documentation":"Once the value is confirmed to be a String, LocalDateTimeRestVariableConverter.getVariableValue calls LocalDateTime.parse; strings that are not valid ISO-8601 local datetimes raise DateTimeParseException, which is wrapped in FlowableIllegalArgumentException including the offending value and the parse exception as cause.","triggerScenarios":"Posting a localDateTime variable whose string is not ISO-8601: e.g. \"10-09-2026 14:30\", \"2026/09/10 14:30\", date-only \"2026-09-10\", epoch strings, or values with unsupported zone/offset suffixes for parse.","commonSituations":"Human-formatted datetimes from UI inputs, date-only strings sent to datetime variables, \"Z\" or \"+02:00\" suffixes, locale-specific separators (space instead of 'T').","solutions":["Format the value as ISO-8601 local datetime (DateTimeFormatter.ISO_LOCAL_DATE_TIME) before sending.","Validate with LocalDateTime.parse client-side to catch bad formats early.","If the value has a zone/offset, convert to a LocalDateTime (or use a zoned variable type) first.","Date-only strings should either gain a time part or be sent as localDate variables."],"exampleFix":"// before\nvariable.setValue(\"2026-09-10 14:30\");\n\n// after\nvariable.setValue(LocalDateTime.of(2026, 9, 10, 14, 30).toString()); // \"2026-09-10T14:30\"","handlingStrategy":"validation","validationCode":"try {\n    LocalDateTime.parse(value);\n} catch (DateTimeParseException e) {\n    throw new IllegalArgumentException(\"Value must be ISO local datetime, got: \" + value, e);\n}","typeGuard":"static boolean isValidIsoLocalDateTime(String s) {\n    try { LocalDateTime.parse(s); return true; } catch (DateTimeParseException | NullPointerException e) { return false; }\n}","tryCatchPattern":"try {\n    Object value = converter.getVariableValue(restVar);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getCause() instanceof DateTimeParseException dpe) {\n        log.error(\"localDateTime '{}' is not ISO format\", restVar.getValue(), dpe);\n    }\n}","preventionTips":["Use LocalDateTime.toString()/ISO_LOCAL_DATE_TIME formatter, not locale formats.","Validate user input datetime strings before submitting variables.","Route date-only values to localDate variables instead."],"tags":["localdatetime","date-parse","invalid-format","rest-variable"],"backgroundTag":"invalid-date-format","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}