{"record":{"id":"ab9ec6709da5299f","repo":"flowable/flowable-engine","slug":"not-supported-to-set-long-value","errorCode":null,"errorMessage":"Not supported to set long value","messagePattern":"Not supported to set long value","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/BatchDeleteProcessConfig.java","lineNumber":531,"sourceCode":"        }\n\n        @Override\n        public void setTextValue2(String textValue2) {\n            throw new UnsupportedOperationException(\"Not supported to set text value2\");\n        }\n\n        @Override\n        public Long getLongValue() {\n            JsonNode longNode = node.path(\"longValue\");\n            if (longNode.isNumber()) {\n                return longNode.longValue();\n            }\n            return null;\n        }\n\n        @Override\n        public void setLongValue(Long longValue) {\n            throw new UnsupportedOperationException(\"Not supported to set long value\");\n        }\n\n        @Override\n        public Double getDoubleValue() {\n            JsonNode doubleNode = node.path(\"doubleValue\");\n            if (doubleNode.isNumber()) {\n                return doubleNode.doubleValue();\n            }\n            return null;\n        }\n\n        @Override\n        public void setDoubleValue(Double doubleValue) {\n            throw new UnsupportedOperationException(\"Not supported to set double value\");\n        }\n\n        @Override\n        public byte[] getBytes() {","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/BatchDeleteProcessConfig.java#L513-L549","documentation":"Deliberate unsupported-operation sentinel: in batch deletion the variable is a read-only JSON-backed snapshot, so mutation methods like setLongValue are hard-wired to throw; it fires only if code tries to modify such a projection.","triggerScenarios":"Calling setLongValue on the template scope from variable-mutation code reused during batch delete configuration or execution.","commonSituations":"Generic variable setter utilities; attempts to adjust numeric variable data as part of cleanup; code that assumed the scope is a live execution variable scope.","solutions":["Update numeric variables through runtimeService.setVariable on the live process instance before deleting","Use the read-only getters (getLongValue) which are backed by the JSON node","Defensively catch UnsupportedOperationException when writing to arbitrary VariableScope implementations","Provide a writable scope subclass for custom batch-delete flows"],"exampleFix":"// before\nbatchScope.setLongValue(42L); // throws\n// after\nruntimeService.setVariable(processInstanceId, \"count\", 42L); // live instance only","handlingStrategy":"validation","validationCode":"// guard numeric writes\nif (scope instanceof org.flowable.engine.impl.delete.BatchDeleteProcessConfig.DeleteVariableScope) {\n    throw new IllegalStateException(\"Read-only scope; use runtimeService.setVariable for long values\");\n}\nscope.setLongValue(longValue);","typeGuard":null,"tryCatchPattern":"try {\n    scope.setLongValue(v);\n} catch (UnsupportedOperationException e) {\n    runtimeService.setVariable(processInstanceId, varName, v);\n}","preventionTips":["Use runtimeService.setVariable for all variable mutations in delete workflows","Treat the template scope as a serialization snapshot only","Add unit tests asserting no writes occur on delete-template scopes"],"tags":["unsupported-operation","flowable","batch-delete","immutable-scope"],"backgroundTag":"unsupported-operation","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"}