{"record":{"id":"8309e889cbbb5afe","repo":"flowable/flowable-engine","slug":"job-is-null-8309e8","errorCode":null,"errorMessage":"job is null","messagePattern":"job is null","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/LockExclusiveJobCmd.java","lineNumber":44,"sourceCode":" * @author Tijs Rademakers\n */\npublic class LockExclusiveJobCmd implements Command<Object>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(LockExclusiveJobCmd.class);\n\n    protected JobEntity job;\n\n    public LockExclusiveJobCmd(JobEntity job) {\n        this.job = job;\n    }\n\n    @Override\n    public Object execute(CommandContext commandContext) {\n\n        if (job == null) {\n            throw new ActivitiIllegalArgumentException(\"job is null\");\n        }\n\n        if (LOGGER.isDebugEnabled()) {\n            LOGGER.debug(\"Executing lock exclusive job {} {}\", job.getId(), job.getExecutionId());\n        }\n\n        if (job.isExclusive()) {\n            if (job.getExecutionId() != null) {\n                ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(job.getExecutionId());\n                if (execution != null) {\n                    commandContext.getExecutionEntityManager().updateProcessInstanceLockTime(execution.getProcessInstanceId());\n                }\n            }\n        }\n\n        return null;\n    }\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/LockExclusiveJobCmd.java#L26-L62","documentation":"Thrown by LockExclusiveJobCmd.execute() when the job field is null. This command locks an exclusive job in the job table and requires a concrete JobEntity, so a null job is rejected immediately with ActivitiIllegalArgumentException.","triggerScenarios":"Calling managementService (or internal command executor) to run LockExclusiveJobCmd with a null job; internal executor paths passing a job that failed to load; constructing the command with no job and executing it.","commonSituations":"Custom async-executor or job-acquisition code feeding null into the command; a job deleted by another thread between acquisition and locking; misconfigured command factory.","solutions":["Ensure the job entity is loaded (fetch JobEntity by id) before locking","Check custom executor code for a path that passes a null job","Re-query the job; if it is gone the work item was already handled and locking is unnecessary"],"exampleFix":"// before\ncommandExecutor.execute(new LockExclusiveJobCmd(job)); // job may be null\n// after\nif (job != null) {\n    commandExecutor.execute(new LockExclusiveJobCmd(job));\n}","handlingStrategy":"validation","validationCode":"if (job == null) throw new IllegalStateException(\"cannot lock a null job\");","typeGuard":null,"tryCatchPattern":"try { commandExecutor.execute(new LockExclusiveJobCmd(job)); } catch (ActivitiIllegalArgumentException e) { log.error(\"lock called with null job\"); }","preventionTips":["Load the JobEntity via managementService/JobEntityManager before locking","Audit custom job-acquisition code for null job paths","Re-check job existence after concurrent deletion"],"tags":["java","activiti","null-argument","job-executor"],"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"}