{"record":{"id":"ae815bc6f7c61bf0","repo":"flowable/flowable-engine","slug":"decision-tenantid-is-null","errorCode":null,"errorMessage":"decision tenantId is null","messagePattern":"decision tenantId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/DecisionQueryImpl.java","lineNumber":245,"sourceCode":"\n    protected void checkVersion(Integer version) {\n        if (version == null) {\n            throw new FlowableIllegalArgumentException(\"version is null\");\n        } else if (version <= 0) {\n            throw new FlowableIllegalArgumentException(\"version must be positive\");\n        }\n    }\n\n    @Override\n    public DecisionQueryImpl latestVersion() {\n        this.latest = true;\n        return this;\n    }\n\n    @Override\n    public DmnDecisionQuery decisionTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"decision tenantId is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public DmnDecisionQuery decisionTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"decision tenantId is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public DmnDecisionQuery decisionWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/DecisionQueryImpl.java#L227-L263","documentation":"DmnDecisionQuery.decisionTenantId(String) throws FlowableIllegalArgumentException(\"decision tenantId is null\") when the tenantId argument is null. Multi-tenant filtering requires a concrete tenant identifier to compare against the TENANT_ID_ column; null is considered invalid input rather than 'match all'.","triggerScenarios":"Calling decisionTenantId(null) — usually the tenant id comes from a security context, request header, or config that is unavailable (anonymous requests, missing tenant provider, standalone engine setup without tenant support configured).","commonSituations":"Applications adding multi-tenancy later where some code paths have no TenantContext; tests running outside the tenant resolver; misconfigured tenant propagation (header name mismatch) leaving the variable null.","solutions":["Guard the call: only apply decisionTenantId when the tenant id is non-null; otherwise run a tenant-agnostic query.","Resolve the tenant from the correct source (security context/request header) and fail fast with a clear message if absent.","If you intended a pattern match, use decisionTenantIdLike with a non-null pattern."],"exampleFix":"// before\nquery.decisionTenantId(tenantContext.getTenantId()); // may be null\n// after\nString tenantId = tenantContext.getTenantId();\nif (tenantId != null) {\n    query.decisionTenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"String tenantId = tenantContext.getTenantId();\nif (tenantId == null || tenantId.isEmpty()) {\n    throw new IllegalStateException(\"no tenant in context; cannot run tenant-scoped query\");\n}\nquery.decisionTenantId(tenantId);","typeGuard":"boolean hasTenant(String t) { return t != null && !t.isEmpty(); }","tryCatchPattern":"try {\n    query.decisionTenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"tenantId\")) {\n        // fall back to tenant-agnostic query\n    } else { throw e; }\n}","preventionTips":["Ensure tenant propagation (header/security context) is configured before querying","Guard all tenant-scoped calls behind a tenant-presence check","In single-tenant deployments, omit tenant filters rather than passing null"],"tags":["java","flowable","dmn","multi-tenancy","null-check","query-builder"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}