{"record":{"id":"5f08451f1f587ae4","repo":"flowable/flowable-engine","slug":"tenant-id-is-null-5f0845","errorCode":null,"errorMessage":"Tenant id is null","messagePattern":"Tenant id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java","lineNumber":873,"sourceCode":"    }\n    \n    @Override\n    public PlanItemInstanceQuery involvedGroups(Collection<String> involvedGroups) {\n        if (involvedGroups == null) {\n            throw new FlowableIllegalArgumentException(\"involvedGroups is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.involvedGroups = involvedGroups;\n        } else {\n            this.involvedGroups = involvedGroups;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"Tenant id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantId = tenantId;\n        } else {\n            this.tenantId = tenantId;\n        }\n        return this;\n    }\n    \n    @Override\n    public PlanItemInstanceQuery planItemInstanceWithoutTenantId() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withoutTenantId = true;\n        } else {\n            this.withoutTenantId = true;\n        }\n        return this;\n    }","sourceCodeStart":855,"sourceCodeEnd":891,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L855-L891","documentation":"PlanItemInstanceQueryImpl.planItemInstanceTenantId(String) throws FlowableIllegalArgumentException when the tenantId string is null. Tenant id is a required, validated filter; a null value would produce an ambiguous query, so the API rejects it eagerly.","triggerScenarios":"Calling planItemInstanceTenantId(null), e.g. when the tenant id is taken from an unauthenticated context, a missing header, or a TenantContext/tenant resolver that returns null.","commonSituations":"Multi-tenant applications where code runs outside a tenant context (background jobs, system tasks) and tenant resolution returns null; copying query-builder code where the tenant is sometimes not filtered.","solutions":["Pass an actual tenant id string; to query across tenants, omit the planItemInstanceTenantId call instead of passing null.","Resolve the tenant id first and skip the call when absent: if (tenantId != null) query.planItemInstanceTenantId(tenantId).","Use planItemInstanceTenantIdLike if a pattern match over tenants is intended."],"exampleFix":"// before\nquery.planItemInstanceTenantId(TenantContext.getTenantId()); // may be null\n// after\nString tenantId = TenantContext.getTenantId();\nif (tenantId != null) {\n    query.planItemInstanceTenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"if (tenantId == null || tenantId.isEmpty()) { skipTenantFilter = true; }","typeGuard":null,"tryCatchPattern":"try { query.planItemInstanceTenantId(tenantId); } catch (FlowableIllegalArgumentException e) { throw new IllegalStateException(\"No tenant context available for query\", e); }","preventionTips":["Resolve tenant context explicitly and skip the tenant filter when absent.","Never rely on a tenant resolver that can silently return null in system/background threads."],"tags":["flowable","cmmn","query","tenant","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-14T11:17:12.474Z"}