{"record":{"id":"aa2c56b1f59981b3","repo":"flowable/flowable-engine","slug":"provided-case-definition-id-is-null-aa2c56","errorCode":null,"errorMessage":"Provided case definition id is null","messagePattern":"Provided case definition id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/JobQueryImpl.java","lineNumber":327,"sourceCode":"            this.scopeDefinitionId = scopeDefinitionId;\n        }\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl caseInstanceId(String caseInstanceId) {\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided case instance id is null\");\n        }\n        scopeId(caseInstanceId);\n        scopeType(ScopeTypes.CMMN);\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl caseDefinitionId(String caseDefinitionId) {\n        if (caseDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided case definition id is null\");\n        }\n        scopeDefinitionId(caseDefinitionId);\n        scopeType(ScopeTypes.CMMN);\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl caseDefinitionKey(String caseDefinitionKey) {\n        if (caseDefinitionKey == null) {\n            throw new FlowableIllegalArgumentException(\"Provided case definition id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionKey = caseDefinitionKey;\n        } else {\n            this.caseDefinitionKey = caseDefinitionKey;\n        }\n        return this;\n    }","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/JobQueryImpl.java#L309-L345","documentation":"JobQueryImpl.caseDefinitionId(String) rejects a null case definition id with FlowableIllegalArgumentException. After the check it delegates to scopeDefinitionId(caseDefinitionId) and sets scopeType(ScopeTypes.CMMN); the guard exists because querying CMMN jobs by an undefined definition id is meaningless. This is a pure argument-validation error thrown at query-construction time, before any database access.","triggerScenarios":"Calling jobQuery.caseDefinitionId(null); typically when the definition id came from a CaseDefinitionQuery that returned no results, or from an unset field on a case instance/plan item object.","commonSituations":"Case definition not deployed under the expected key/tenant so lookups return null; migration/version-upgrade code where the definition id resolution changed; generic job-listing code that shares one builder for process and case definitions.","solutions":["Resolve the case definition id via repositoryService.createCaseDefinitionQuery() and verify it is non-null before querying jobs","Query by caseDefinitionKey instead if the id is unknown (but still pass a non-null key)","Skip the filter when null and query all CMMN jobs, filtering afterwards","Check deployment/tenant configuration if the definition should exist"],"exampleFix":"// before\nCaseDefinition def = repo.createCaseDefinitionQuery().caseDefinitionKey(key).singleResult();\njobQuery.caseDefinitionId(def.getId()); // NPE-prone and can be null\n// after\nCaseDefinition def = repo.createCaseDefinitionQuery().caseDefinitionKey(key).singleResult();\nif (def != null) {\n    jobQuery.caseDefinitionId(def.getId());\n}","handlingStrategy":"validation","validationCode":"CaseDefinition def = repositoryService.createCaseDefinitionQuery().caseDefinitionId(id).singleResult();\nif (def == null) { throw new IllegalArgumentException(\"Unknown case definition id: \" + id); }\njobQuery.caseDefinitionId(id);","typeGuard":"boolean isDeployedCaseDefinition(String id) { return id != null && repositoryService.createCaseDefinitionQuery().caseDefinitionId(id).count() > 0; }","tryCatchPattern":"try {\n    jobQuery.caseDefinitionId(caseDefinitionId);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"caseDefinitionId was null\", e);\n}","preventionTips":["Resolve case definition ids from CaseDefinitionQuery results with null checks","Use caseDefinitionKey when the id is unknown (non-null keys only)","Verify deployments exist for the tenant before querying"],"tags":["flowable","java","null-check","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"}