{"record":{"id":"d7304d149f4202ec","repo":"flowable/flowable-engine","slug":"not-supported-to-get-process-instance-id","errorCode":null,"errorMessage":"Not supported to get process instance id","messagePattern":"Not supported to get process instance id","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/BatchDeleteProcessConfig.java","lineNumber":472,"sourceCode":"        return resultNode.toString();\n    }\n\n    protected static class VariableValueJsonNodeValueFields implements ValueFields {\n\n        protected final JsonNode node;\n\n        public VariableValueJsonNodeValueFields(JsonNode node) {\n            this.node = node;\n        }\n\n        @Override\n        public String getName() {\n            return node.path(\"name\").stringValue();\n        }\n\n        @Override\n        public String getProcessInstanceId() {\n            throw new UnsupportedOperationException(\"Not supported to get process instance id\");\n        }\n\n        @Override\n        public String getExecutionId() {\n            throw new UnsupportedOperationException(\"Not supported to get execution id\");\n        }\n\n        @Override\n        public String getScopeId() {\n            throw new UnsupportedOperationException(\"Not supported to get scope id\");\n        }\n\n        @Override\n        public String getSubScopeId() {\n            throw new UnsupportedOperationException(\"Not supported to get sub scope id\");\n        }\n\n        @Override","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/BatchDeleteProcessConfig.java#L454-L490","documentation":"This is an UnsupportedOperationException from an anonymous VariableInstance implementation inside BatchDeleteProcessConfig that is backed only by a JSON node used to extract variable values for query population. Process-instance/execution identity is meaningless for this adapter, so the getters explicitly reject calls rather than returning misleading nulls.","triggerScenarios":"Calling getProcessInstanceId() (or getExecutionId()) on the variable-instance adapter produced while deserializing batch-query variable values — only possible if internal code or custom code paths treat the JSON-backed adapter as a real runtime VariableInstance.","commonSituations":"Custom extensions or copy-pasted internals reusing BatchDeleteProcessConfig's JSON variable adapter for purposes beyond query population; engine version upgrades exposing the adapter through new call paths.","solutions":["Do not call getProcessInstanceId/getExecutionId on the JSON-backed variable adapter; only getName() and getValue() are supported","Use the real VariableInstance entity from the runtime/variable service when you need execution context","Construct a full variable instance implementation if your integration needs execution ids"],"exampleFix":"// before\nString pid = jsonBackedVariableInstance.getProcessInstanceId(); // throws\n// after\nString pid = realVariableInstanceEntity.getProcessInstanceId();","handlingStrategy":"type-guard","validationCode":"if (vi instanceof JsonBackedVariableInstance) {\n    throw new IllegalStateException(\"Adapter has no execution context; use the real VariableInstance\");\n}","typeGuard":"boolean hasExecutionContext(VariableInstance vi) {\n    return !(isJsonBackedAdapter(vi));\n}","tryCatchPattern":"try {\n    pid = vi.getProcessInstanceId();\n} catch (UnsupportedOperationException e) {\n    pid = null; // JSON-backed adapter carries no execution identity\n}","preventionTips":["Only read name/value from the JSON-backed adapter","Obtain execution identity from the actual VariableInstance entity via the variable service","Do not reuse internal BatchDeleteProcessConfig adapters in custom code"],"tags":["unsupported-operation","variables","internal-api"],"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"}