{"record":{"id":"007f0d8d2ff2cbbb","repo":"flowable/flowable-engine","slug":"deploymenttenantid-is-null","errorCode":null,"errorMessage":"deploymentTenantId is null","messagePattern":"deploymentTenantId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentQueryImpl.java","lineNumber":123,"sourceCode":"            throw new FlowableIllegalArgumentException(\"deploymentCategoryExclude is null\");\n        }\n        this.categoryNotEquals = deploymentCategoryNotEquals;\n        return this;\n    }\n    \n    @Override\n    public AppDeploymentQueryImpl deploymentKey(String deploymentKey) {\n        if (deploymentKey == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentKey is null\");\n        }\n        this.key = deploymentKey;\n        return this;\n    }\n\n    @Override\n    public AppDeploymentQueryImpl deploymentTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentTenantId is null\");\n        }\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public AppDeploymentQueryImpl deploymentTenantIdLike(String tenantIdLike) {\n        if (tenantIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentTenantIdLike is null\");\n        }\n        this.tenantIdLike = tenantIdLike;\n        return this;\n    }\n\n    @Override\n    public AppDeploymentQueryImpl deploymentWithoutTenantId() {\n        this.withoutTenantId = true;\n        return this;","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentQueryImpl.java#L105-L141","documentation":"AppDeploymentQueryImpl.deploymentTenantId(String) throws FlowableIllegalArgumentException when the tenantId argument is null. The Flowable query builders validate each criterion eagerly at setter time so that an invalid query fails at construction rather than producing a broken SQL query at execution. Passing null for an exact tenant filter is not a supported way to express 'no filter' — simply omit the call instead.","triggerScenarios":"Calling appDeploymentService.createDeploymentQuery().deploymentTenantId(null), typically when the tenant id is supplied by a variable, request parameter, or config value that is null at query time.","commonSituations":"REST/API layers forwarding a missing tenantId query parameter; multi-tenant apps where TenantContext.getTenantId() returns null before tenant resolution; refactoring that replaced an optional-tenant path with an unconditional setter call.","solutions":["Ensure a non-null tenant id is resolved before building the query (e.g. require the tenantId request parameter or resolve it from the authenticated principal)","Only call deploymentTenantId(...) when the value is non-null; omit it to query across all tenants","If a default tenant is acceptable, fall back to a constant (e.g. \"default\") when the resolved id is null"],"exampleFix":"// before\nquery.deploymentTenantId(tenantContext.getTenantId());\n// after\nString tenantId = tenantContext.getTenantId();\nif (tenantId != null) {\n    query.deploymentTenantId(tenantId);\n}","handlingStrategy":"validation","validationCode":"if (tenantId == null || tenantId.isEmpty()) {\n    throw new IllegalArgumentException(\"tenantId must be provided for deploymentTenantId filter, or omit the filter\");\n}\nquery.deploymentTenantId(tenantId);","typeGuard":"boolean hasTenant = tenantId instanceof String s && !s.isEmpty();","tryCatchPattern":"try {\n    query.deploymentTenantId(tenantId);\n} catch (FlowableIllegalArgumentException e) {\n    // tenantId was null — build query without tenant filter or rethrow with context\n    logger.warn(\"No tenant id resolved; querying all tenants\", e);\n}","preventionTips":["Resolve tenant context before query construction","Use an Optional<String> and only set the filter when present","Never pass null as a query criterion — omit the setter instead"],"tags":["null-argument","query-builder","flowable"],"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"}