{"record":{"id":"ead358d8f4fe9215","repo":"flowable/flowable-engine","slug":"tenant-id-is-null","errorCode":null,"errorMessage":"tenant id is null","messagePattern":"tenant id is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricMilestoneInstanceQueryImpl.java","lineNumber":102,"sourceCode":"    public HistoricMilestoneInstanceQuery milestoneInstanceReachedAfter(Date reachedAfter) {\n        this.reachedAfter = reachedAfter;\n        return this;\n    }\n\n    @Override\n    public HistoricMilestoneInstanceQuery orderByMilestoneName() {\n        return orderBy(MilestoneInstanceQueryProperty.MILESTONE_NAME);\n    }\n\n    @Override\n    public HistoricMilestoneInstanceQuery orderByTimeStamp() {\n        return orderBy(MilestoneInstanceQueryProperty.MILESTONE_TIMESTAMP);\n    }\n    \n    @Override\n    public HistoricMilestoneInstanceQuery 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 HistoricMilestoneInstanceQuery 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 HistoricMilestoneInstanceQuery milestoneInstanceWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricMilestoneInstanceQueryImpl.java#L84-L120","documentation":"HistoricMilestoneInstanceQueryImpl.milestoneInstanceTenantId() rejects a null tenantId with FlowableIllegalArgumentException. Tenant-id filtering must be an exact string; passing null is treated as a programming mistake rather than 'no filter'.","triggerScenarios":"Calling milestoneInstanceTenantId(null), often from a variable that was supposed to hold the tenant id (e.g. request parameter or tenant context) but is null.","commonSituations":"Multi-tenant apps where the tenant id comes from a header/context that is absent for unauthenticated or admin paths; API wrappers forwarding nullable parameters.","solutions":["Check the tenant id for null before calling milestoneInstanceTenantId and skip the filter if filtering is intended to be global","Supply the correct tenant id string","Use tenantIsNotNull() or simply omit tenant filtering if you want all tenants","Fix the upstream source (header/context extraction) that yields null"],"exampleFix":"// before\nquery.milestoneInstanceTenantId(tenantId).list();\n// after\nif (tenantId != null) {\n    query.milestoneInstanceTenantId(tenantId);\n}\nList<HistoricMilestoneInstance> results = query.list();","handlingStrategy":"validation","validationCode":"if (tenantId != null) {\n    query.milestoneInstanceTenantId(tenantId);\n}","typeGuard":"boolean hasTenant(String t) { return t != null && !t.isEmpty(); }","tryCatchPattern":"try {\n    query.milestoneInstanceTenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    if (!\"tenant id is null\".equals(e.getMessage())) throw e;\n    // proceed without tenant filter or fail fast with a clearer message\n}","preventionTips":["Null-check tenant ids sourced from headers or tenant contexts before filtering","Skip tenant filter methods instead of passing null to mean 'no filter'","Use Objects.requireNonNull with a domain-specific message to fail at the call site"],"tags":["flowable","cmmn","query-api","null-argument","tenant"],"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"}