{"record":{"id":"646767d28628a2d6","repo":"flowable/flowable-engine","slug":"jobid-is-null-646767","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/ExecuteAsyncRunnableJobCmd.java","lineNumber":64,"sourceCode":"\n    public ExecuteAsyncRunnableJobCmd(String jobId, JobInfoEntityManager<? extends JobInfoEntity> jobEntityManager,\n            JobServiceConfiguration jobServiceConfiguration, boolean unlock) {\n        \n        this.jobId = jobId;\n        this.jobEntityManager = jobEntityManager;\n        this.jobServiceConfiguration = jobServiceConfiguration;\n        this.unlock = unlock;\n    }\n\n    @Override\n    public Object execute(CommandContext commandContext) {\n        \n        if (jobEntityManager == null) {\n            throw new FlowableIllegalArgumentException(\"jobEntityManager is null\");\n        }\n\n        if (jobId == null) {\n            throw new FlowableIllegalArgumentException(\"jobId is null\");\n        }\n\n        // We need to refetch the job, as it could have been deleted by another concurrent job\n        // For example: an embedded subprocess with a couple of async tasks and a timer on the boundary of the subprocess\n        // when the timer fires, all executions and thus also the jobs inside of the embedded subprocess are destroyed.\n        // However, the async task jobs could already have been fetched and put in the queue.... while in reality they have been deleted.\n        // A refetch is thus needed here to be sure that it exists for this transaction.\n\n        JobInfoEntity job = jobEntityManager.findById(jobId);\n        if (job == null) {\n            LOGGER.debug(\"Job does not exist anymore and will not be executed. It has most likely been deleted \"\n                    + \"as part of another concurrent part of the process instance.\");\n            return null;\n        }\n\n        if (LOGGER.isDebugEnabled()) {\n            if (job instanceof JobEntity) {\n                LOGGER.debug(\"Executing async job {}\", job.getId());","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/ExecuteAsyncRunnableJobCmd.java#L46-L82","documentation":"ExecuteAsyncRunnableJobCmd validates both dependencies: if its injected jobEntityManager is null it throws \"jobEntityManager is null\", and if jobId is null it throws FlowableIllegalArgumentException(\"jobId is null\"). Unlike ExecuteAsyncJobCmd it does not fall back to the configuration, so both fields must be supplied explicitly.","triggerScenarios":"Executing new ExecuteAsyncRunnableJobCmd(null, ...) or new ExecuteAsyncRunnableJobCmd(em, null) via the command executor; async runnable dispatch paths that lost the entity manager reference.","commonSituations":"Hand-wiring the command in tests or custom code without providing the entity manager; job runnable factories passing a job whose id was never assigned; misconfiguration where a custom JobEntityManager bean is missing.","solutions":["Pass a non-null JobEntityManager obtained from JobServiceConfiguration when constructing the command.","Ensure the job id is set on the entity before dispatching the runnable.","Prefer ExecuteAsyncJobCmd, which resolves the entity manager from the configuration as a fallback.","Add null checks in the code that instantiates this command so failures surface at your boundary."],"exampleFix":"// before\nnew ExecuteAsyncRunnableJobCmd(null, jobId); // jobEntityManager is null\n// after\nnew ExecuteAsyncRunnableJobCmd(jobServiceConfiguration.getJobEntityManager(), jobId);","handlingStrategy":"validation","validationCode":"if (jobEntityManager == null) { throw new IllegalArgumentException(\"jobEntityManager required\"); }\nif (jobId == null) { throw new IllegalArgumentException(\"jobId required\"); }","typeGuard":null,"tryCatchPattern":"try { commandExecutor.execute(cmd); } catch (FlowableIllegalArgumentException e) { LOGGER.error(\"Bad ExecuteAsyncRunnableJobCmd input: {}\", e.getMessage()); }","preventionTips":["Always source the JobEntityManager from JobServiceConfiguration, never hand-roll nulls.","Prefer ExecuteAsyncJobCmd which falls back to the configuration's entity manager.","Set the entity id before dispatching any runnable."],"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"}