{"record":{"id":"8f7e0eefad8f1b47","repo":"flowable/flowable-engine","slug":"tenant-id-is-null-8f7e0e","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/MilestoneInstanceQueryImpl.java","lineNumber":91,"sourceCode":"        return this;\n    }\n\n    @Override\n    public MilestoneInstanceQuery milestoneInstanceReachedBefore(Date reachedBefore) {\n        this.reachedBefore = reachedBefore;\n        return this;\n    }\n\n    @Override\n    public MilestoneInstanceQuery milestoneInstanceReachedAfter(Date reachedAfter) {\n        this.reachedAfter = reachedAfter;\n        return this;\n    }\n    \n    @Override\n    public MilestoneInstanceQuery milestoneInstanceTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"tenant id is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public MilestoneInstanceQuery milestoneInstanceTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"tenant id is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n    \n    @Override\n    public MilestoneInstanceQuery milestoneInstanceWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/MilestoneInstanceQueryImpl.java#L73-L109","documentation":"MilestoneInstanceQueryImpl.milestoneInstanceTenantId(String) filters milestone instances by tenant. A null tenant id is treated as a programming error rather than an absent filter, so FlowableIllegalArgumentException is thrown; use milestoneInstanceTenantIdWithoutTenantCheck()/ignoreTenant filtering instead of passing null.","triggerScenarios":"Calling milestoneInstanceTenantId(null) on a milestone instance query, typically with a tenant id sourced from a nullable variable or request parameter.","commonSituations":"Tenant context not set in a multi-tenant app; passing the result of a lookup that returned null; attempting to 'clear' a tenant filter by passing null.","solutions":["Only call milestoneInstanceTenantId when the tenant id is non-null; skip the filter otherwise","Fix the tenant provider so it always supplies a valid tenant id","If you want milestone instances regardless of tenant, do not set a tenant filter at all"],"exampleFix":"// before\nquery.milestoneInstanceTenantId(tenantId); // NPE-style IAE when null\n// after\nif (tenantId != null) {\n    query.milestoneInstanceTenantId(tenantId);\n}","handlingStrategy":"type-guard","validationCode":"if (tenantId != null) { query.milestoneInstanceTenantId(tenantId); }","typeGuard":"boolean hasTenant(String t) { return t != null && !t.trim().isEmpty(); }","tryCatchPattern":"try { query.milestoneInstanceTenantId(tenantId); } catch (FlowableIllegalArgumentException e) { query = runtimeService.createMilestoneInstanceQuery(); }","preventionTips":["Guard nullable tenant context before applying tenant filters","Use a TenantProvider that throws early when tenant context is absent","Never pass null to clear a filter; omit the filter instead"],"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"}