{"record":{"id":"2a979098127262f0","repo":"flowable/flowable-engine","slug":"activity-tenant-id-is-null-2a9790","errorCode":null,"errorMessage":"activity tenant id is null","messagePattern":"activity tenant id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java","lineNumber":213,"sourceCode":"        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQuery deleteReason(String deleteReason) {\n        this.deleteReason = deleteReason;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQuery deleteReasonLike(String deleteReasonLike) {\n        this.deleteReasonLike = deleteReasonLike;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQueryImpl activityTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"activity tenant id is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    public String getTenantId() {\n        return tenantId;\n    }\n\n    @Override\n    public HistoricActivityInstanceQueryImpl activityTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"activity tenant id is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java#L195-L231","documentation":"HistoricActivityInstanceQueryImpl.activityTenantId(String) requires a non-null tenant id to filter activity instances by exact tenant. Passing null throws FlowableIllegalArgumentException since the criterion would be ambiguous; to query across all tenants, simply do not call this method.","triggerScenarios":"Calling query.activityTenantId(null), or passing a tenant id resolved from context/config that is null (e.g. multi-tenant apps where the current tenant was not resolved).","commonSituations":"Multi-tenant deployments where tenant resolution fails or defaults are missing; code that unconditionally applies tenant filters even when the request is tenant-less.","solutions":["Only call activityTenantId(tenantId) when tenantId != null","Fix tenant resolution (default tenant provider) so a valid tenant id is always available","Use activityTenantIdLike(pattern) with a non-null pattern if fuzzy matching across tenants is intended"],"exampleFix":"// before\nquery.activityTenantId(TenantContext.getCurrentTenantId());\n\n// after\nString tenantId = TenantContext.getCurrentTenantId();\nif (tenantId != null) {\n    query.activityTenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"if (tenantId != null) {\n    query.activityTenantId(tenantId);\n}","typeGuard":"boolean hasTenantId(String t) { return t != null && !t.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.activityTenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"activity tenant id is null\")) throw e;\n    // rebuild query without tenant filter\n}","preventionTips":["Resolve tenants with a default-provider before applying tenant filters","Apply tenant criteria only when a tenant context actually exists"],"tags":["flowable","query","tenant","null-argument","java"],"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"}