{"record":{"id":"fc6703f406b26241","repo":"flowable/flowable-engine","slug":"the-given-variable-value-is-not-an-instant-r","errorCode":null,"errorMessage":"The given variable value is not an instant: '\" + result.getValue() + \"'","messagePattern":"The given variable value is not an instant: '\" \\+ result\\.getValue\\(\\) \\+ \"'","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/InstantRestVariableConverter.java","lineNumber":44,"sourceCode":"    public String getRestTypeName() {\n        return \"instant\";\n    }\n\n    @Override\n    public Class<?> getVariableType() {\n        return Instant.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 instant\");\n            }\n            try {\n                return Instant.parse((String) result.getValue());\n            } catch (DateTimeParseException e) {\n                throw new FlowableIllegalArgumentException(\"The given variable value is not an instant: '\" + 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 Instant)) {\n                throw new FlowableIllegalArgumentException(\"Converter can only convert instant\");\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/InstantRestVariableConverter.java#L26-L62","documentation":"InstantRestVariableConverter.getVariableValue calls Instant.parse on the string value; when parsing fails with DateTimeParseException it wraps it in a FlowableIllegalArgumentException naming the bad value. Instant.parse requires strict ISO-8601 with offset 'Z' or ±hh:mm.","triggerScenarios":"Reading an 'instant'-typed REST variable whose String value is not valid ISO-8601 instant syntax (e.g. '2026-09-10', '2026-09-10T10:00:00' without zone, '10-09-2026 10:00').","commonSituations":"Clients storing LocalDateTime/LocalDate strings without the mandatory zone offset; date-only strings; locale-formatted dates written by an external system or manual DB edit.","solutions":["Correct the variable value to a full ISO-8601 instant string ending with 'Z' or an offset, e.g. 2026-09-10T12:00:00Z.","Store the value as an Instant/date type in the engine rather than a hand-formatted string.","Normalize/validate the string with Instant.parse in application code before setVariable.","If the value genuinely has no time zone, use the 'date' REST type or store a LocalDate representation instead."],"exampleFix":"// before\nruntimeService.setVariable(executionId, \"timestamp\", \"2026-09-10T12:00:00\");\n// after\nruntimeService.setVariable(executionId, \"timestamp\", \"2026-09-10T12:00:00Z\");","handlingStrategy":"validation","validationCode":"public static boolean isValidInstant(String v) {\n    if (v == null) return false;\n    try { java.time.Instant.parse(v); return true; } catch (java.time.format.DateTimeParseException e) { return false; }\n}","typeGuard":"public static boolean isParseableInstantString(Object v) { return v instanceof String s && isValidInstant(s); }","tryCatchPattern":"try {\n    Object ts = restClient.getVariable(id, \"firedAt\");\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"The given variable value is not an instant\")) {\n        // re-set the variable with a valid ISO-8601 instant string\n    } else { throw e; }\n}","preventionTips":["Always include the zone designator: 'Z' or ±hh:mm in stored instant strings.","Run Instant.parse on values before setVariable to fail fast.","Never store date-only or local-date-time strings under the instant REST type."],"tags":["rest","instant","date-format","parsing"],"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"}