{"record":{"id":"24037fb6f5141faa","repo":"flowable/flowable-engine","slug":"tenantid-is-null-24037f","errorCode":null,"errorMessage":"tenantId is null","messagePattern":"tenantId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/HistoricDecisionExecutionQueryImpl.java","lineNumber":171,"sourceCode":"    @Override\n    public DmnHistoricDecisionExecutionQuery caseInstanceIdWithChildren(String caseInstanceId) {\n        this.caseInstanceIdWithChildren = caseInstanceId;\n        return this;\n    }\n    \n    @Override\n    public DmnHistoricDecisionExecutionQuery failed(Boolean failed) {\n        if (failed == null) {\n            throw new FlowableIllegalArgumentException(\"failed is null\");\n        }\n        this.failed = failed;\n        return this;\n    }\n\n    @Override\n    public DmnHistoricDecisionExecutionQuery 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 DmnHistoricDecisionExecutionQuery tenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"tenantId is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public DmnHistoricDecisionExecutionQuery withoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/HistoricDecisionExecutionQueryImpl.java#L153-L189","documentation":"FlowableIllegalArgumentException thrown by DmnHistoricDecisionExecutionQuery.tenantId(String) when a null tenant identifier is passed. Tenant id is used to filter historic decision executions in multi-tenant deployments; the library rejects null eagerly so the query never runs with an unintended 'match all tenants' semantics.","triggerScenarios":"Calling .tenantId(null) on a DmnHistoricDecisionExecutionQuery — usually when the tenant id is taken from an unset context, an absent authentication/session attribute, or a null field in the calling code.","commonSituations":"Multi-tenant apps where tenant resolution failed and returned null instead of a default tenant; copying query-building code where tenantId was optional; unit tests passing null placeholders.","solutions":["Pass the actual non-null tenant id string the executions were created with.","If tenant filtering is not needed, omit the tenantId() call.","For pattern matching use tenantIdLike(pattern) with a non-null string, or null-check the resolved tenant before querying."],"exampleFix":"// before\nquery.tenantId(tenantContext.getTenantId()); // getTenantId() may return null\n// after\nString tenantId = tenantContext.getTenantId();\nif (tenantId != null) {\n    query.tenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"String tenantId = tenantContext.getTenantId();\nif (tenantId == null || tenantId.isEmpty()) {\n    throw new IllegalStateException(\"No tenant resolved for query\");\n}\nquery.tenantId(tenantId);","typeGuard":"boolean hasTenant(Object v) { return v instanceof String s && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.tenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    throw new IllegalStateException(\"Tenant resolution failed before query\", e);\n}","preventionTips":["Resolve and validate the tenant id before building any query.","Use tenantIdLike() with a default pattern if tenant is optional.","Fail early at tenant-resolution time rather than at query-build time."],"tags":["flowable","dmn","query","tenant","null-check"],"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"}