{"record":{"id":"ad5e8c8eb98265b2","repo":"flowable/flowable-engine","slug":"provided-correlationid-is-null-ad5e8c","errorCode":null,"errorMessage":"Provided correlationId is null","messagePattern":"Provided correlationId 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":360,"sourceCode":"            this.caseDefinitionKey = caseDefinitionKey;\n        }\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl planItemInstanceId(String planItemInstanceId) {\n        if (planItemInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided plan item instance id is null\");\n        }\n        subScopeId(planItemInstanceId);\n        scopeType(ScopeTypes.CMMN);\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl correlationId(String correlationId) {\n        if (correlationId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided correlationId is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.correlationId = correlationId;\n        } else {\n            this.correlationId = correlationId;\n        }\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl executionId(String executionId) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided execution id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.executionId = executionId;\n        } else {\n            this.executionId = executionId;","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/JobQueryImpl.java#L342-L378","documentation":"JobQueryImpl.correlationId(String) validates that the correlation id filter is non-null and throws FlowableIllegalArgumentException otherwise. The correlation id links jobs (e.g. async/external jobs) to business correlations, and a null filter would be meaningless, so it is rejected at query build time. The value is stored on the query or the active or-query object depending on whether the call happens inside an or() block.","triggerScenarios":"Calling jobQuery.correlationId(null); typically when the correlation id comes from message metadata, a header, or a config property that was missing; also inside or(...) compositions.","commonSituations":"Message/event payload lacked the correlation header; upgrade where correlationId support was newly introduced and older records/payloads carry null; generic query builders passing optional fields through.","solutions":["Ensure the correlation id is set on the source message/payload before querying","Null-check and skip the correlationId filter, falling back to other filters","Populate correlation ids when creating jobs so downstream queries always have one","Trace where the value is read from (header/config) and add validation there"],"exampleFix":"// before\njobQuery.correlationId(message.getCorrelationId()); // may be null\n// after\nString cid = message.getCorrelationId();\nif (cid != null && !cid.isEmpty()) {\n    jobQuery.correlationId(cid);\n}","handlingStrategy":"validation","validationCode":"if (correlationId == null || correlationId.isEmpty()) { throw new IllegalArgumentException(\"correlationId must not be null/empty\"); }\njobQuery.correlationId(correlationId);","typeGuard":"boolean hasCorrelationId(String c) { return c != null && !c.isEmpty(); }","tryCatchPattern":"try {\n    jobQuery.correlationId(correlationId);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"correlationId was null\", e);\n}","preventionTips":["Always populate correlation ids when creating jobs","Extract and validate correlation headers from messages before querying","Treat correlationId as optional in query builders and skip when absent"],"tags":["flowable","java","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"}