{"record":{"id":"cf2243fa3114ec1d","repo":"flowable/flowable-engine","slug":"correlationid-is-null","errorCode":null,"errorMessage":"correlationId is null","messagePattern":"correlationId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/GetJobByCorrelationIdCmd.java","lineNumber":38,"sourceCode":"\n/**\n * @author Filip Hrisafov\n */\npublic class GetJobByCorrelationIdCmd implements Command<Job> {\n    \n    protected JobServiceConfiguration jobServiceConfiguration;\n\n    protected String correlationId;\n\n    public GetJobByCorrelationIdCmd(String correlationId, JobServiceConfiguration jobServiceConfiguration) {\n        this.correlationId = correlationId;\n        this.jobServiceConfiguration = jobServiceConfiguration;\n    }\n\n    @Override\n    public Job execute(CommandContext commandContext) {\n        if (correlationId == null) {\n            throw new FlowableIllegalArgumentException(\"correlationId is null\");\n        }\n\n        Job job = jobServiceConfiguration.getDeadLetterJobEntityManager().findJobByCorrelationId(correlationId);\n        if (job != null) {\n            return job;\n        }\n\n        job = jobServiceConfiguration.getExternalWorkerJobEntityManager().findJobByCorrelationId(correlationId);\n        if (job != null) {\n            return job;\n        }\n\n        job = jobServiceConfiguration.getTimerJobEntityManager().findJobByCorrelationId(correlationId);\n        if (job != null) {\n            return job;\n        }\n\n        job = jobServiceConfiguration.getSuspendedJobEntityManager().findJobByCorrelationId(correlationId);","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/GetJobByCorrelationIdCmd.java#L20-L56","documentation":"GetJobByCorrelationIdCmd throws FlowableIllegalArgumentException when correlationId is null. It searches dead-letter jobs (and fallback entity managers) for a job whose correlation id matches; a null correlation id cannot identify any job and is rejected before querying.","triggerScenarios":"Executing new GetJobByCorrelationIdCmd(null, cfg) or job-service APIs that look up jobs by correlation id with a null value; message-driven flows where the correlation id header was absent.","commonSituations":"Middleware/integration code that failed to propagate a correlation id from the incoming message; jobs created without a correlation id then looked up by one; configuration where the correlation id extractor returns null.","solutions":["Ensure the correlation id is extracted and non-null before calling the lookup.","Check how the job was created — if no correlation id was set at creation, lookup by correlation id cannot work.","Guard message-processing code to reject/dlq messages without a correlation id header.","Log the incoming correlation id at the entry point to find where it is lost."],"exampleFix":"// before\nJob job = cmdExecutor.execute(new GetJobByCorrelationIdDto(correlationId).toCmd(cfg)); // correlationId null\n// after\nif (correlationId == null) {\n    throw new IllegalArgumentException(\"correlationId required for job lookup\");\n}\nJob job = cmdExecutor.execute(new GetJobByCorrelationIdCmd(correlationId, cfg));","handlingStrategy":"validation","validationCode":"if (correlationId == null || correlationId.isBlank()) { throw new IllegalArgumentException(\"correlationId required\"); }","typeGuard":null,"tryCatchPattern":"try { Job job = commandExecutor.execute(new GetJobByCorrelationIdCmd(correlationId, cfg)); } catch (FlowableIllegalArgumentException e) { /* missing correlation id */ }","preventionTips":["Propagate correlation ids end-to-end in message-driven flows; reject messages missing them.","Ensure jobs are created with a correlation id if you plan to look them up by one.","Log incoming correlation ids at entry points to locate where nulls originate."],"tags":["flowable","job-service","null-argument","correlation-id"],"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"}