{"record":{"id":"9087af449849461e","repo":"flowable/flowable-engine","slug":"process-instance-id-is-null-9087af","errorCode":null,"errorMessage":"Process instance id is null","messagePattern":"Process instance id is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java","lineNumber":143,"sourceCode":"            throw new ActivitiIllegalArgumentException(\"Process definition name is null\");\n        }\n        this.processDefinitionName = processDefinitionName;\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery processDefinitionVersion(Integer processDefinitionVersion) {\n        if (processDefinitionVersion == null) {\n            throw new ActivitiIllegalArgumentException(\"Process definition version is null\");\n        }\n        this.processDefinitionVersion = processDefinitionVersion;\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl processInstanceId(String processInstanceId) {\n        if (processInstanceId == null) {\n            throw new ActivitiIllegalArgumentException(\"Process instance id is null\");\n        }\n        this.processInstanceId = processInstanceId;\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery processInstanceBusinessKey(String businessKey) {\n        if (businessKey == null) {\n            throw new ActivitiIllegalArgumentException(\"Business key is null\");\n        }\n        this.businessKey = businessKey;\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery processInstanceBusinessKey(String processInstanceBusinessKey, boolean includeChildExecutions) {\n        if (!includeChildExecutions) {\n            return processInstanceBusinessKey(processInstanceBusinessKey);","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java#L125-L161","documentation":"ExecutionQueryImpl.processInstanceId throws ActivitiIllegalArgumentException when the processInstanceId argument is null. The query builder rejects null filter values so that the resulting query is always well-formed. Pass a real process instance id to filter on it.","triggerScenarios":"Calling query.processInstanceId(id) with a null id, typically when the id came from an uninitialized variable, an empty API path variable, or a failed lookup.","commonSituations":"REST handlers forwarding path parameters that were never populated; code that resolved a process instance reference earlier and got null; refactors where the id variable was renamed and a different (null) variable is passed.","solutions":["Ensure the process instance id is resolved to a non-null value before building the query","Skip adding the processInstanceId criterion when the id is unknown instead of passing null","Fail earlier in your own code with a clearer error if the id is required but missing"],"exampleFix":"// before\nExecutionQuery q = runtimeService.createExecutionQuery().processInstanceId(instanceId);\n// after\nif (instanceId == null) {\n    throw new IllegalStateException(\"processInstanceId is required\");\n}\nExecutionQuery q = runtimeService.createExecutionQuery().processInstanceId(instanceId);","handlingStrategy":"validation","validationCode":"if (processInstanceId == null || processInstanceId.isEmpty()) { throw new IllegalStateException(\"processInstanceId required\"); }","typeGuard":"boolean hasId = processInstanceId != null && !processInstanceId.isEmpty();","tryCatchPattern":"try { q.processInstanceId(id); } catch (ActivitiIllegalArgumentException e) { respondBadRequest(e.getMessage()); }","preventionTips":["Resolve ids through APIs that fail loudly when not found","Null-check parameters at REST/service boundaries before building queries","Keep id variables non-null by construction (Optional with orElseThrow)"],"tags":["java","activiti","query-builder","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-18T16:30:33.424Z"}