{"record":{"id":"6d08e3db5cb2b025","repo":"flowable/flowable-engine","slug":"case-definition-tenantid-is-null","errorCode":null,"errorMessage":"case definition tenantId is null","messagePattern":"case definition tenantId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CaseDefinitionQueryImpl.java","lineNumber":273,"sourceCode":"    @Override\n    public CaseDefinitionQueryImpl latestVersion() {\n        this.latest = true;\n        return this;\n    }\n\n    @Override\n    public CaseDefinitionQuery caseDefinitionTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"caseDefinition tenantId is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public CaseDefinitionQuery caseDefinitionTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"case definition tenantId is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public CaseDefinitionQuery caseDefinitionWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;\n    }\n\n    @Override\n    public CaseDefinitionQuery locale(String locale) {\n        this.locale = locale;\n        return this;\n    }\n\n    @Override","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CaseDefinitionQueryImpl.java#L255-L291","documentation":"caseDefinitionTenantIdLike in CaseDefinitionQueryImpl throws FlowableIllegalArgumentException with \"case definition tenantId is null\" when the tenantIdLike argument is null. The 'like' variant accepts SQL-style wildcard patterns (e.g. \"acme-%\") but never null; omit the call for an unfiltered query.","triggerScenarios":"Calling caseDefinitionTenantIdLike(null), usually from a dynamic filter builder that forwards a null pattern variable.","commonSituations":"REST query params where the tenantLike filter is absent; template-driven queries with unsubstituted placeholders; mixing up an empty string (allowed) with null (rejected).","solutions":["Guard with a null check and call caseDefinitionTenantIdLike only when a pattern is present.","Use an explicit wildcard like \"%\" if a broad match is intended, instead of null.","Fix the upstream source of the pattern so it produces an empty-absent signal rather than null."],"exampleFix":"// before\nquery.caseDefinitionTenantIdLike(pattern);\n\n// after\nif (pattern != null) {\n    query.caseDefinitionTenantIdLike(pattern);\n}","handlingStrategy":"validation","validationCode":"if (tenantIdLike != null) {\n    query.caseDefinitionTenantIdLike(tenantIdLike);\n}","typeGuard":"boolean hasPattern(String p) { return p != null; }","tryCatchPattern":"try {\n    query.caseDefinitionTenantIdLike(pattern);\n} catch (FlowableIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"tenantId is null\")) throw e;\n    logger.warn(\"tenantIdLike filter skipped: null pattern\");\n}","preventionTips":["Null-check 'like' patterns sourced from optional request parameters","Distinguish empty string (allowed) from null (rejected)","Build queries with a helper that skips null filters uniformly"],"tags":["null-argument","multi-tenancy","query-builder","cmmn"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}