{"record":{"id":"b15a941af16c552c","repo":"flowable/flowable-engine","slug":"execution-id-is-null","errorCode":null,"errorMessage":"Execution id is null","messagePattern":"Execution id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java","lineNumber":470,"sourceCode":"    }\n    \n    @Override\n    public ExecutionQuery excludeProcessDefinitionKeys(Set<String> excludeProcessDefinitionKeys) {\n        if (excludeProcessDefinitionKeys == null) {\n            throw new FlowableIllegalArgumentException(\"Process definition keys is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.excludeProcessDefinitionKeys = excludeProcessDefinitionKeys;\n        } else {\n            this.excludeProcessDefinitionKeys = excludeProcessDefinitionKeys;\n        }\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl executionId(String executionId) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"Execution id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.executionId = executionId;\n        } else {\n            this.executionId = executionId;\n        }\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl activityId(String activityId) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.activityId = activityId;\n            if (activityId != null) {\n                this.currentOrQueryObject.isActive = true;\n            }\n            \n        } else {","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java#L452-L488","documentation":"executionId() pins the query to a single execution by its database ID. Flowable throws FlowableIllegalArgumentException when the ID string is null, since an ID equality predicate cannot be formed from null. Failing fast prevents issuing a query that would silently match nothing or everything.","triggerScenarios":"Calling executionQuery.executionId(null), commonly when the execution ID variable was never populated or was returned null from a previous lookup (e.g. task.getExecutionId() on a detached entity).","commonSituations":"A prior Task/Execution lookup returned null and its ID was propagated; deserialized DTOs with missing id fields; REST path parameters parsed to null.","solutions":["Pass a valid non-null execution ID string (a 32-char Flowable UUID, e.g. from task.getExecutionId())","Check the ID for null before calling executionId() and take an alternate code path when absent","Fix the upstream lookup that produced the null ID (entity not found or not refreshed)","For broader searches, drop the executionId() restriction and filter by other criteria instead"],"exampleFix":"// before\nExecution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult(); // throws if null\n// after\nString execId = task.getExecutionId();\nExecution execution = execId != null\n    ? runtimeService.createExecutionQuery().executionId(execId).singleResult()\n    : null;","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(executionId, \"executionId must not be null before querying\");\nquery.executionId(executionId);","typeGuard":"boolean hasExecutionId(Task t) { return t != null && t.getExecutionId() != null; }","tryCatchPattern":"try {\n    query.executionId(executionId);\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    throw new IllegalStateException(\"Cannot query execution: no execution id available\", e);\n}","preventionTips":["Never chain executionId() off a possibly-null entity lookup without checking","Validate IDs exist after task/service calls before follow-up queries","Distinguish 'no id' from 'id not found' in error handling","Use Optional<String> for propagated IDs to force explicit null handling"],"tags":["flowable","query-validation","null-argument"],"backgroundTag":"null-argument","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"}