{"record":{"id":"ae06aaaf9bbf170a","repo":"flowable/flowable-engine","slug":"tenantid-is-null","errorCode":null,"errorMessage":"tenantId is null","messagePattern":"tenantId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java","lineNumber":175,"sourceCode":"            throw new FlowableIllegalArgumentException(\"subScopeId is null\");\n        }\n        this.subScopeId = subScopeId;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery scopeType(String scopeType) {\n        if (scopeType == null) {\n            throw new FlowableIllegalArgumentException(\"scopeType is null\");\n        }\n        this.scopeType = scopeType;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery tenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"tenantId is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery tenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"tenantIdLike is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery withoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java#L157-L193","documentation":"BatchPartQueryImpl.tenantId() throws FlowableIllegalArgumentException when the tenantId argument is null. Flowable treats tenant filtering as an explicit exact-match operation; to query across tenants you omit the call, you never pass null.","triggerScenarios":"Calling batchPartQuery().tenantId(null), or forwarding a tenant id from a security/context holder that has no tenant set (single-tenant deployments).","commonSituations":"Multi-tenant code paths running without authenticated tenant context; copying tenantId from an entity where TENANT_ID_ is empty string but code yields null.","solutions":["Pass a non-null tenant id string (use empty string \"\" if you mean the default tenant)","Omit .tenantId(...) entirely when querying across all tenants","Check the tenant context/resolver before building the query"],"exampleFix":"// before\nquery.tenantId(tenantContext.getCurrentTenantId()); // may be null\n// after\nString tenantId = tenantContext.getCurrentTenantId();\nif (tenantId != null) {\n    query.tenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"String tenantId = tenantContext.getCurrentTenantId();\nif (tenantId == null) {\n    throw new IllegalStateException(\"No tenant in context; cannot build tenant-scoped batch part query\");\n}\nquery.tenantId(tenantId);","typeGuard":"boolean hasTenantId(String t) { return t != null && !t.isEmpty(); }","tryCatchPattern":"try {\n    query.tenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    // tenant context lost; run unfiltered or fail with a clearer error\n}","preventionTips":["In single-tenant setups use empty string \"\" or omit the filter, never null","Resolve tenant id once in an interceptor and reject requests without it","Distinguish 'no tenant filter' (omit) from 'default tenant' (empty string)"],"tags":["java","flowable","null-check","multi-tenancy"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T16:30:33.424Z"}