{"record":{"id":"0b7aad4a3a779a24","repo":"flowable/flowable-engine","slug":"provided-event-subscription-id-is-null-0b7aad","errorCode":null,"errorMessage":"Provided event subscription id is null","messagePattern":"Provided event subscription id is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/EventSubscriptionQueryImpl.java","lineNumber":49,"sourceCode":"    protected String eventSubscriptionId;\r\n    protected String eventName;\r\n    protected String eventType;\r\n    protected String executionId;\r\n    protected String processInstanceId;\r\n    protected String activityId;\r\n    protected String tenantId;\r\n\r\n    public EventSubscriptionQueryImpl(CommandContext commandContext) {\r\n        super(commandContext);\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl(CommandExecutor commandExecutor) {\r\n        super(commandExecutor);\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl eventSubscriptionId(String id) {\r\n        if (eventSubscriptionId == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided event subscription id is null\");\r\n        }\r\n        this.eventSubscriptionId = id;\r\n        return this;\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl eventName(String eventName) {\r\n        if (eventName == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided event name is null\");\r\n        }\r\n        this.eventName = eventName;\r\n        return this;\r\n    }\r\n\r\n    public EventSubscriptionQueryImpl executionId(String executionId) {\r\n        if (executionId == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Provided execution id is null\");\r\n        }\r\n        this.executionId = executionId;\r","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/EventSubscriptionQueryImpl.java#L31-L67","documentation":"This Activiti (Flowable 5) error is thrown by EventSubscriptionQueryImpl.eventSubscriptionId when the id passed in is null. Query criterion setters validate arguments eagerly so a malformed query fails fast at build time rather than producing an opaque failure or wrong results when the query is executed via the CommandExecutor. It signals a programming mistake by the caller, not a runtime state problem.","triggerScenarios":"Calling runtimeService.createEventSubscriptionQuery().eventSubscriptionId(null) or passing a variable/field that is null because an earlier lookup (e.g. eventSubscription.getId()) returned null.","commonSituations":"Chaining query builders where the id comes from an optional entity; copy-pasted query code where the wrong variable is passed; code refactors where the id lookup was removed or made optional; using a null return from getEventSubscriptions/lookup APIs as query input without checking.","solutions":["Check the id for null before calling eventSubscriptionId and skip the criterion (or the whole query) when absent","Fix the upstream lookup so a real event subscription id is produced before building the query","If null means 'no filter', do not call the setter at all instead of passing null","Wrap the query construction in a guard that asserts required filter values are non-null"],"exampleFix":"// before\nEventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery().eventSubscriptionId(subId);\n// after\nif (subId != null) {\n    EventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery().eventSubscriptionId(subId);\n} else {\n    EventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery();\n}","handlingStrategy":"validation","validationCode":"if (eventSubscriptionId == null) { throw new IllegalArgumentException(\"eventSubscriptionId must be non-null before querying\"); }\nEventSubscriptionQuery q = runtimeService.createEventSubscriptionQuery().eventSubscriptionId(eventSubscriptionId);","typeGuard":"boolean hasId(String id) { return id != null && !id.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.eventSubscriptionId(id);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    // id was null: fix caller logic or skip the criterion\n}","preventionTips":["Null-check ids obtained from entity lookups before using them as query criteria","Omit optional setters instead of passing null","Use Objects.requireNonNull with a clear message at the id's origin","Avoid relying on APIs that may return null ids; prefer Optional lookups"],"tags":["java","activiti","query","null-check"],"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"}