{"record":{"id":"a274e53ddbd376f4","repo":"flowable/flowable-engine","slug":"converter-can-only-convert-booleans-a274e5","errorCode":null,"errorMessage":"Converter can only convert booleans","messagePattern":"Converter can only convert booleans","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/DateRestVariableConverter.java","lineNumber":56,"sourceCode":"    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}\n","sourceCodeStart":38,"sourceCodeEnd":65,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/DateRestVariableConverter.java#L38-L65","documentation":"DateRestVariableConverter.convertVariableValue serializes a java.util.Date to ISO-8601 for REST output. If the value handed to the converter is not null and not a Date, it throws this FlowableIllegalArgumentException. The message is a known copy-paste bug in the Flowable source: it says 'booleans' although this converter handles dates.","triggerScenarios":"The REST layer passes a non-Date, non-null object (e.g. String, Long, Instant) to the date converter, either because the variable type was misregistered or because the value was stored as a different type than the converter's getVariableType() (java.util.Date) claims.","commonSituations":"Custom variable converters registered with overlapping types; a variable stored as String but requested with the date converter; upgrading Flowable versions changed variable serialization defaults.","solutions":["Store the variable as a java.util.Date so the date converter receives the expected type.","Check the REST variable converter registry for a misconfigured converter claiming to handle java.util.Date.","Use the correct REST variable type name (e.g. 'string' or 'instant') that matches the actual stored value.","Ignore the misleading 'booleans' wording; it is a message typo — the real issue is a type mismatch with Date."],"exampleFix":"// before\nruntimeService.setVariable(executionId, \"createdAt\", \"2026-09-10\");\n// after\nruntimeService.setVariable(executionId, \"createdAt\", new Date());","handlingStrategy":"type-guard","validationCode":"public static boolean isRestDateValue(Object v) { return v == null || v instanceof java.util.Date; }","typeGuard":"public static java.util.Date asDate(Object v) {\n    if (v instanceof java.util.Date d) return d;\n    if (v instanceof java.time.Instant i) return java.util.Date.from(i);\n    return null;\n}","tryCatchPattern":"try {\n    converter.convertVariableValue(value, restVariable);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().equals(\"Converter can only convert booleans\")) {\n        converter.convertVariableValue(asDate(value), restVariable);\n    } else { throw e; }\n}","preventionTips":["Remember the message text is a Flowable typo; it actually means the value is not a java.util.Date.","Only pass java.util.Date instances to the date converter.","Keep converter registrations consistent with the Java types they claim."],"tags":["rest","date","type-mismatch","variable-converter"],"backgroundTag":"type-mismatch","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"}