{"record":{"id":"6475a19fdecfd7a0","repo":"flowable/flowable-engine","slug":"the-given-variable-value-is-not-a-date-resul","errorCode":null,"errorMessage":"The given variable value is not a date: '\" + result.getValue() + \"'","messagePattern":"The given variable value is not a date: '\" \\+ result\\.getValue\\(\\) \\+ \"'","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/DateRestVariableConverter.java","lineNumber":46,"sourceCode":"    public String getRestTypeName() {\n        return \"date\";\n    }\n\n    @Override\n    public Class<?> getVariableType() {\n        return Date.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 date\");\n            }\n            try {\n                return RequestUtil.parseLongDate((String) result.getValue());\n            } catch (DateTimeParseException e) {\n                throw new FlowableIllegalArgumentException(\"The given variable value is not a date: '\" + 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 Date dateValue)) {\n                throw new FlowableIllegalArgumentException(\"Converter can only convert booleans\");\n            }\n            result.setValue(dateValue.toInstant().toString());\n        } else {\n            result.setValue(null);\n        }\n    }\n\n}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/DateRestVariableConverter.java#L28-L64","documentation":"The date REST variable converter parses a string variable value with RequestUtil.parseLongDate(). When the string does not parse as an ISO-8601 date, a DateTimeParseException is wrapped into a FlowableIllegalArgumentException that includes the offending value. It is thrown from getVariableValue when converting an engine variable to a REST date representation.","triggerScenarios":"Calling a REST endpoint that reads a process/execution/task variable whose declared REST type is 'date', where the stored value is a String that RequestUtil.parseLongDate cannot parse (e.g. '2026-13-45', 'yesterday', empty string, or missing timezone offset).","commonSituations":"A variable was set externally or by an older engine version as a plain string instead of a java.util.Date; a client wrote a non-ISO date format; a timezone suffix was omitted; the value was manually edited in the ACT_RU_VARIABLE table.","solutions":["Inspect the variable value returned in the message and correct it to the format expected by RequestUtil.parseLongDate (ISO-8601, e.g. 2026-09-10T00:00:00.000Z).","Re-set the variable in the engine as a java.util.Date (or ISO string) instead of an arbitrary string.","Change the variable's REST type to 'string' if the value is not meant to be a date.","If the value originates from a form or upstream API, validate/normalize the date format before storing it."],"exampleFix":"// before\nruntimeService.setVariable(processInstanceId, \"dueDate\", \"10/09/2026\");\n// after\nruntimeService.setVariable(processInstanceId, \"dueDate\", \"2026-09-10T00:00:00.000Z\");","handlingStrategy":"validation","validationCode":"public static boolean isValidRestDate(String v) {\n    if (v == null) return false;\n    try { RequestUtil.parseLongDate(v); return true; } catch (Exception e) { return false; }\n}","typeGuard":"public static boolean isDateString(Object v) { return v instanceof String && isValidRestDate((String) v); }","tryCatchPattern":"try {\n    Object value = restClient.getVariable(id, \"dueDate\");\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"The given variable value is not a date\")) {\n        // fix or re-set the variable as a proper date\n    } else { throw e; }\n}","preventionTips":["Always store date variables as java.util.Date or ISO-8601 strings, never locale-formatted strings.","Validate/parse dates at the point of setVariable so bad formats fail early.","Pin the REST variable type name to match the stored Java type."],"tags":["rest","date","variable-converter","format"],"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-14T11:17:12.474Z"}