{"record":{"id":"cd4ffac3cfb3fe88","repo":"flowable/flowable-engine","slug":"no-execution-active-no-variables-can-be-removed","errorCode":null,"errorMessage":"No execution active, no variables can be removed","messagePattern":"No execution active, no variables can be removed","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/el/NoExecutionVariableScope.java","lineNumber":229,"sourceCode":"        return false;\n    }\n\n    @Override\n    public boolean hasVariableLocal(String variableName) {\n        return false;\n    }\n\n    public void createVariableLocal(String variableName, Object value) {\n        throw new UnsupportedOperationException(\"No execution active, no variables can be created\");\n    }\n\n    public void createVariablesLocal(Map<String, ? extends Object> variables) {\n        throw new UnsupportedOperationException(\"No execution active, no variables can be created\");\n    }\n\n    @Override\n    public void removeVariable(String variableName) {\n        throw new UnsupportedOperationException(\"No execution active, no variables can be removed\");\n    }\n\n    @Override\n    public void removeVariableLocal(String variableName) {\n        throw new UnsupportedOperationException(\"No execution active, no variables can be removed\");\n    }\n\n    @Override\n    public void removeVariables() {\n        throw new UnsupportedOperationException(\"No execution active, no variables can be removed\");\n    }\n\n    @Override\n    public void removeVariablesLocal() {\n        throw new UnsupportedOperationException(\"No execution active, no variables can be removed\");\n    }\n\n    @Override","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/el/NoExecutionVariableScope.java#L211-L247","documentation":"NoExecutionVariableScope.removeVariable(name) always throws UnsupportedOperationException because deleting a variable requires an execution or task that owns it; this stub has neither. The throw is deliberate design so accidental writes on a read-only, execution-less scope fail immediately.","triggerScenarios":"Calling removeVariable(String) on a NoExecutionVariableScope reference, e.g. from generic VariableScope-consuming code paths or listeners evaluated without an execution.","commonSituations":"Cleanup logic in delegates assuming an execution scope; standalone EL evaluation contexts; unit tests reusing the stub.","solutions":["Use an execution-backed scope or runtimeService.removeVariable(executionId, name)","Guard removal with an instanceof NoExecutionVariableScope check","Restrict NoExecutionVariableScope to read-only evaluation paths"],"exampleFix":"// before\nscope.removeVariable(\"temp\"); // throws\n// after\nruntimeService.removeVariable(executionId, \"temp\");","handlingStrategy":"try-catch","validationCode":"if (scope instanceof NoExecutionVariableScope) {\n    throw new IllegalStateException(\"No execution: cannot remove variable \" + name);\n}","typeGuard":"boolean supportsVariableRemoval(VariableScope scope) {\n    return !(scope instanceof NoExecutionVariableScope);\n}","tryCatchPattern":"try {\n    scope.removeVariable(name);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"No execution active\")) {\n        runtimeService.removeVariable(executionId, name);\n    } else throw e;\n}","preventionTips":["Remove variables via runtimeService/taskService when no scope is active","Never perform cleanup logic against NoExecutionVariableScope","Guard generic VariableScope-handling code with instanceof checks"],"tags":["variables","unsupported-operation","flowable"],"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"}