{"record":{"id":"02b9faa983fac2ea","repo":"flowable/flowable-engine","slug":"tenant-id-is-null-02b9fa","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/history/HistoricPlanItemInstanceQueryImpl.java","lineNumber":415,"sourceCode":"            this.tenantId = tenantId;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricPlanItemInstanceQuery planItemInstanceWithoutTenantId() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withoutTenantId = true;\n        } else {\n            this.withoutTenantId = true;\n        }\n        return this;\n    }\n    \n    @Override\n    public HistoricPlanItemInstanceQuery planItemInstanceTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"tenant id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantIdLike = tenantIdLike;\n        } else {\n            this.tenantIdLike = tenantIdLike;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricPlanItemInstanceQuery createdBefore(Date createdBefore) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.createdBefore = createdBefore;\n        } else {\n            this.createdBefore = createdBefore;\n        }\n        return this;\n    }","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricPlanItemInstanceQueryImpl.java#L397-L433","documentation":"HistoricPlanItemInstanceQueryImpl.planItemInstanceTenantIdLike() validates its argument and throws FlowableIllegalArgumentException when a null tenantIdLike is passed. The query API refuses null because a null 'like' filter is ambiguous — use the non-like tenantId filter or omit it entirely. This is a fail-fast guard so misconfigured queries break at build time rather than returning wrong results.","triggerScenarios":"Calling planItemInstanceTenantIdLike(null) on a HistoricPlanItemInstanceQuery, typically when the tenant id comes from a variable, config, or request parameter that is null.","commonSituations":"Multi-tenant setups where the tenant id is resolved from an authenticated principal or header that is absent; passing an unset configuration property straight into the query builder.","solutions":["Pass a non-null string to planItemInstanceTenantIdLike","If you do not need to filter by tenant, do not call the method at all","If the filter value is optional, guard it: only call the method when the value is non-null","If an exact (non-like) tenant match is intended, use planItemInstanceTenantId instead"],"exampleFix":"// before\nquery.planItemInstanceTenantIdLike(tenantId); // NPE-ish failure when tenantId is null\n// after\nif (tenantId != null) {\n    query.planItemInstanceTenantIdLike(tenantId);\n}","handlingStrategy":"validation","validationCode":"if (tenantIdLike == null) {\n    throw new IllegalArgumentException(\"tenantIdLike must not be null; omit the filter or use planItemInstanceTenantId\");\n}\nhistoricPlanItemInstanceQuery.planItemInstanceTenantIdLike(tenantIdLike);","typeGuard":"boolean isUsableTenantFilter(String tenantIdLike) {\n    return tenantIdLike != null && !tenantIdLike.isEmpty();\n}","tryCatchPattern":"try {\n    query.planItemInstanceTenantIdLike(tenantIdLike);\n} catch (FlowableIllegalArgumentException e) {\n    // tenantIdLike was null — fall back to unfiltered query or fix input\n}","preventionTips":["Null-check tenant ids resolved from security context or request headers before query building","Only call tenant filter methods when a tenant filter is actually configured","Prefer planItemInstanceTenantId for exact matches to avoid like-pattern pitfalls"],"tags":["flowable","cmmn","query","null-argument","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-14T05:17:10.506Z"}