{"record":{"id":"658e03dc6a25da84","repo":"flowable/flowable-engine","slug":"converter-can-only-convert-big-integer-values","errorCode":null,"errorMessage":"Converter can only convert big integer values","messagePattern":"Converter can only convert big integer values","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/BigIntegerRestVariableConverter.java","lineNumber":44,"sourceCode":"\n    @Override\n    public Class<?> getVariableType() {\n        return BigInteger.class;\n    }\n\n    @Override\n    public Object getVariableValue(EngineRestVariable result) {\n        if (result.getValue() != null) {\n            return new BigInteger(result.getValue().toString());\n        }\n        return null;\n    }\n\n    @Override\n    public void convertVariableValue(Object variableValue, EngineRestVariable result) {\n        if (variableValue != null) {\n            if (!(variableValue instanceof BigInteger)) {\n                throw new FlowableIllegalArgumentException(\"Converter can only convert big integer values\");\n            }\n            result.setValue(variableValue.toString());\n            \n        } else {\n            result.setValue(null);\n        }\n    }\n\n}\n","sourceCodeStart":26,"sourceCodeEnd":54,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/BigIntegerRestVariableConverter.java#L26-L54","documentation":"BigIntegerRestVariableConverter handles only java.math.BigInteger engine variables. In convertVariableValue it type-checks the value and throws FlowableIllegalArgumentException for any non-BigInteger object, since the converter's wire format (a plain string) is only defined for BigInteger.","triggerScenarios":"A variable value that is not BigInteger (e.g. Long, Integer, BigDecimal) reaching this converter during REST variable conversion, or direct calls to convertVariableValue with the wrong numeric type.","commonSituations":"Direct converter invocation in custom REST extensions with a Long value; REST request type names mismatched so the wrong converter is chosen; engine variables migrated from Long to BigInteger (or vice versa) across versions.","solutions":["Pass a java.math.BigInteger to the converter (use BigInteger.valueOf(longValue) for longs).","Send REST variables with the correct type name so the matching converter (integer/long) is selected instead.","If the underlying value is a BigDecimal, use BigDecimalRestVariableConverter rather than this one.","In custom code, branch on the runtime type before choosing which RestVariableConverter to call."],"exampleFix":"// before\nconverter.convertVariableValue(42L, restVariable); // Long -> throws\n// after\nconverter.convertVariableValue(BigInteger.valueOf(42L), restVariable);","handlingStrategy":"type-guard","validationCode":"if (value != null && !(value instanceof BigInteger)) {\n    value = BigInteger.valueOf(((Number) value).longValue());\n}","typeGuard":"BigInteger asBigInteger(Object v) {\n    if (v instanceof BigInteger) return (BigInteger) v;\n    if (v instanceof Number) return BigInteger.valueOf(((Number) v).longValue());\n    return null;\n}","tryCatchPattern":"try {\n    converter.convertVariableValue(value, restVariable);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"big integer\")) {\n        converter.convertVariableValue(BigInteger.valueOf(((Number) value).longValue()), restVariable);\n    } else throw e;\n}","preventionTips":["Send integer variables as int/long types so the correct converter is selected.","Use BigInteger only when values may exceed Long range; otherwise use the long converter.","Verify the REST 'type' field matches the engine variable type.","Guard converter calls with instanceof checks in custom REST extensions."],"tags":["rest","variables","type-mismatch","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"}