{"record":{"id":"b927ebdd54ecf615","repo":"flowable/flowable-engine","slug":"jobid-is-null-b927eb","errorCode":null,"errorMessage":"JobId is null","messagePattern":"JobId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/ExecuteJobCmd.java","lineNumber":50,"sourceCode":"public class ExecuteJobCmd implements Command<Object>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ExecuteJobCmd.class);\n\n    protected String jobId;\n    protected JobServiceConfiguration jobServiceConfiguration;\n\n    public ExecuteJobCmd(String jobId, JobServiceConfiguration jobServiceConfiguration) {\n        this.jobId = jobId;\n        this.jobServiceConfiguration = jobServiceConfiguration;\n    }\n\n    @Override\n    public Object execute(CommandContext commandContext) {\n\n        if (jobId == null) {\n            throw new FlowableIllegalArgumentException(\"JobId is null\");\n        }\n\n        Job job = jobServiceConfiguration.getJobEntityManager().findById(jobId);\n\n        if (job == null) {\n            throw new JobNotFoundException(jobId);\n        }\n\n        if (LOGGER.isDebugEnabled()) {\n            LOGGER.debug(\"Executing job {}\", job.getId());\n        }\n\n        InternalJobCompatibilityManager internalJobCompatibilityManager = jobServiceConfiguration.getInternalJobCompatibilityManager();\n        if (internalJobCompatibilityManager != null && internalJobCompatibilityManager.isFlowable5Job(job)) {\n            internalJobCompatibilityManager.executeV5Job(job);\n            return null;\n        }\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/ExecuteJobCmd.java#L32-L68","documentation":"ExecuteJobCmd throws FlowableIllegalArgumentException(\"JobId is null\") when its jobId is null, then looks the job up and throws JobNotFoundException when absent. It is the command behind executing an existing async job by id.","triggerScenarios":"managementService.executeJob(null) or executing new ExecuteJobCmd(null); executor paths that lost the id between dequeue and command creation.","commonSituations":"Custom code resuming dead-letter jobs where the id came back null from a query wrapper; calling executeJob on a variable not yet assigned; tests invoking the command directly.","solutions":["Pass a non-null job id obtained from managementService.createJobQuery() results.","If resuming a failed job, take the id from the DeadLetterJobQuery result, not a stale variable.","Guard wrapper methods with Objects.requireNonNull before invoking the API.","Ensure your queue/dequeue code preserves the id field."],"exampleFix":"// before\nmanagementService.executeJob(jobId); // may be null\n// after\nObjects.requireNonNull(jobId, \"jobId must not be null\");\nmanagementService.executeJob(jobId);","handlingStrategy":"validation","validationCode":"if (jobId == null) { throw new IllegalArgumentException(\"jobId must not be null before executeJob\"); }","typeGuard":null,"tryCatchPattern":"try { managementService.executeJob(jobId); } catch (FlowableIllegalArgumentException e) { /* caller bug: null id */ } catch (JobNotFoundException e) { /* job already gone */ }","preventionTips":["Take ids directly from JobQuery/DeadLetterJobQuery results.","Use Objects.requireNonNull in service wrappers.","Handle JobNotFoundException separately so null-id and not-found cases are not conflated."],"tags":["flowable","job-service","null-argument","async-job"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}