{"record":{"id":"e489550302308e80","repo":"flowable/flowable-engine","slug":"provided-process-definition-id-is-null-e48955","errorCode":null,"errorMessage":"Provided process definition id is null","messagePattern":"Provided process 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/SuspendedJobQueryImpl.java","lineNumber":151,"sourceCode":"            this.processInstanceId = processInstanceId;\n        }\n        return this;\n    }\n    \n    @Override\n    public SuspendedJobQueryImpl withoutProcessInstanceId() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withoutProcessInstanceId = true;\n        } else {\n            this.withoutProcessInstanceId = true;\n        }\n        return this;\n    }\n\n    @Override\n    public SuspendedJobQueryImpl processDefinitionId(String processDefinitionId) {\n        if (processDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided process definition id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionId = processDefinitionId;\n        } else {\n            this.processDefinitionId = processDefinitionId;\n        }\n        return this;\n    }\n\n    @Override\n    public SuspendedJobQueryImpl processDefinitionKey(String processDefinitionKey) {\n        if (processDefinitionKey == null) {\n            throw new FlowableIllegalArgumentException(\"Provided process definition key is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionKey = processDefinitionKey;\n        } else {\n            this.processDefinitionKey = processDefinitionKey;","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java#L133-L169","documentation":"Flowable throws FlowableIllegalArgumentException when SuspendedJobQueryImpl.processDefinitionId() is called with a null argument. Query criteria methods in Flowable validate inputs eagerly so that invalid queries fail at definition time rather than producing broken SQL at execution. Passing null explicitly is never allowed for this criterion.","triggerScenarios":"Calling jobQuerySuspensionState...processDefinitionId(null) on a SuspendedJobQuery (e.g. createSuspendedJobQuery().processDefinitionId(variable that is null)).","commonSituations":"A processDefinitionId variable read from config, a request parameter, or an optional lookup (e.g. repositoryService.createProcessDefinitionQuery().singleResult() returning null) is passed straight into the query without a null check.","solutions":["Ensure the caller supplies a real process definition id before building the query","Skip the processDefinitionId criterion when the value is null instead of calling the method","Validate/resolve the id upstream (e.g. check the result of a process definition lookup) before querying"],"exampleFix":"// before\nList<Job> jobs = managementService.createJobQuery().suspended().processDefinitionId(defId).list();\n// after\nJobQuery q = managementService.createJobQuery().suspended();\nif (defId != null) {\n    q = q.processDefinitionId(defId);\n}\nList<Job> jobs = q.list();","handlingStrategy":"validation","validationCode":"if (processDefinitionId == null) {\n    throw new IllegalArgumentException(\"processDefinitionId must be provided\");\n}\nmanagementService.createJobQuery().suspended().processDefinitionId(processDefinitionId);","typeGuard":"boolean hasProcessDefinitionId = (id != null && !id.isBlank());","tryCatchPattern":null,"preventionTips":["Guard optional filter values before passing them to Flowable query builders","Never chain criteria from variables that may be null","Resolve process definition lookups with null checks before using their results","Centralize query building in a helper that applies criteria conditionally"],"tags":["flowable","null-check","query-api"],"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"}