{"record":{"id":"292271f676796814","repo":"flowable/flowable-engine","slug":"provided-process-instance-id-is-null","errorCode":null,"errorMessage":"Provided process instance id is null","messagePattern":"Provided process instance id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java","lineNumber":149,"sourceCode":"    @Override\n    public EventSubscriptionQueryImpl executionId(String executionId) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided execution id is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.executionId = executionId;\n        } else {\n            this.executionId = executionId;\n        }\n\n        return this;\n    }\n\n    @Override\n    public EventSubscriptionQueryImpl processInstanceId(String processInstanceId) {\n        if (processInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided process instance id is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processInstanceId = processInstanceId;\n        } else {\n            this.processInstanceId = processInstanceId;\n        }\n\n        return this;\n    }\n    \n    @Override\n    public EventSubscriptionQueryImpl withoutProcessInstanceId() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withoutProcessInstanceId = true;\n        } else {\n            this.withoutProcessInstanceId = true;\n        }","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java#L131-L167","documentation":"Flowable throws FlowableIllegalArgumentException from EventSubscriptionQueryImpl.processInstanceId when the processInstanceId() query builder method is called with a null argument. The query API rejects null IDs because a null filter is indistinguishable from 'not filtered at all', so instead of silently returning wrong results it fails fast. Pass a non-null process instance id string or skip the filter entirely.","triggerScenarios":"Calling runtimeService.createEventSubscriptionQuery().processInstanceId(null) or adding .processInstanceId(null) inside an or() block; any code path where the id variable comes from an unpopulated execution, variable, or API response that is null.","commonSituations":"Chaining query filters from a request parameter or context object that was never set (e.g. no process instance associated with a task); refactoring code that used to have the id; calling processInstanceId before the instance has started.","solutions":["Check the id for null before calling processInstanceId and only add the filter when it is non-null","Fix the upstream source so the process instance id is actually populated (task.getProcessInstanceId(), execution id, etc.)","If you do not need the filter, omit the processInstanceId() call instead of passing null","If you own the calling code, wrap the query building in a guard that skips null filters"],"exampleFix":"// before\nList<EventSubscription> subs = runtimeService.createEventSubscriptionQuery()\n    .processInstanceId(procInstId)\n    .list();\n\n// after\nEventSubscriptionQueryImpl q = (EventSubscriptionQueryImpl) runtimeService.createEventSubscriptionQuery();\nif (procInstId != null) {\n    q.processInstanceId(procInstId);\n}\nList<EventSubscription> subs = q.list();","handlingStrategy":"validation","validationCode":"if (processInstanceId == null) {\n    throw new IllegalStateException(\"processInstanceId required before querying event subscriptions\");\n}\nquery.processInstanceId(processInstanceId);","typeGuard":"if (id instanceof String && !((String) id).isEmpty()) { /* safe to filter */ }","tryCatchPattern":"try {\n    query.processInstanceId(id).list();\n} catch (FlowableIllegalArgumentException e) {\n    // log and fall back to unfiltered query or empty result\n}","preventionTips":["Null-check every id before adding it to a Flowable query","Use Objects.requireNonNull on parameters at service boundaries","Build query filters conditionally only when values exist","Never pass null to *Query setter methods to mean 'no filter' — omit the call"],"tags":["flowable","null-check","query-builder","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-18T11:17:12.947Z"}