{"record":{"id":"c9dcb2effc8c7593","repo":"flowable/flowable-engine","slug":"executionid-is-null-c9dcb2","errorCode":null,"errorMessage":"executionId is null","messagePattern":"executionId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableCmd.java","lineNumber":47,"sourceCode":" * @author Joram Barrez\n */\npublic class GetExecutionVariableCmd implements Command<Object>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String executionId;\n    protected String variableName;\n    protected boolean isLocal;\n\n    public GetExecutionVariableCmd(String executionId, String variableName, boolean isLocal) {\n        this.executionId = executionId;\n        this.variableName = variableName;\n        this.isLocal = isLocal;\n    }\n\n    @Override\n    public Object execute(CommandContext commandContext) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"variableName is null\");\n        }\n\n        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);\n\n        if (execution == null) {\n            throw new FlowableObjectNotFoundException(\"execution \" + executionId + \" doesn't exist\", Execution.class);\n        }\n\n        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            return compatibilityHandler.getExecutionVariable(executionId, variableName, isLocal);\n        }\n\n        Object value;\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableCmd.java#L29-L65","documentation":"GetExecutionVariableCmd.execute() rejects a null executionId with FlowableIllegalArgumentException before any lookup. A variable cannot be read without identifying an execution, so null is treated as a programming/caller error.","triggerScenarios":"Calling RuntimeService.getVariable(executionId, variableName) or getVariableLocal with executionId == null, typically from unguarded code paths where the execution reference was never resolved.","commonSituations":"A prior executionQuery returned null and its id was passed on; map/DTO fields not populated; conditional code skipping assignment.","solutions":["Null-check the executionId before calling the runtime service.","Resolve the execution first via a query and use Objects.requireNonNull on its id.","At API boundaries return 400-level validation errors when the execution id parameter is missing.","Fail fast in calling code with a descriptive exception instead of letting the engine throw."],"exampleFix":"// before\nObject value = runtimeService.getVariable(executionId, name);\n// after\nif (executionId != null) {\n    Object value = runtimeService.getVariable(executionId, name);\n}","handlingStrategy":"validation","validationCode":"if (executionId == null) {\n    throw new IllegalArgumentException(\"executionId is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.getVariable(executionId, name);\n} catch (FlowableIllegalArgumentException e) {\n    // null executionId: fix caller, never expected at runtime\n}","preventionTips":["Resolve execution ids from queries, never from nullable variables","Fail fast with requireNonNull in service code","Validate path parameters at REST layer","Avoid passing query results straight through when they may be null"],"tags":["flowable","null-argument","variable","validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T16:30:33.424Z"}