{"record":{"id":"782179daddb9f7c3","repo":"flowable/flowable-engine","slug":"jobid-and-job-is-null-782179","errorCode":null,"errorMessage":"jobId and job is null","messagePattern":"jobId and job is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/MoveJobToDeadLetterJobCmd.java","lineNumber":48,"sourceCode":"public class MoveJobToDeadLetterJobCmd implements Command<DeadLetterJobEntity>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(MoveJobToDeadLetterJobCmd.class);\n\n    protected String jobId;\n    protected JobServiceConfiguration jobServiceConfiguration;\n\n    public MoveJobToDeadLetterJobCmd(String jobId, JobServiceConfiguration jobServiceConfiguration) {\n        this.jobId = jobId;\n        this.jobServiceConfiguration = jobServiceConfiguration;\n    }\n\n    @Override\n    public DeadLetterJobEntity execute(CommandContext commandContext) {\n\n        if (jobId == null) {\n            throw new FlowableIllegalArgumentException(\"jobId and job is null\");\n        }\n\n        AbstractRuntimeJobEntity job = jobServiceConfiguration.getTimerJobEntityManager().findById(jobId);\n        if (job == null) {\n            job = jobServiceConfiguration.getJobEntityManager().findById(jobId);\n        }\n\n        if (job == null) {\n            throw new JobNotFoundException(jobId);\n        }\n\n        if (LOGGER.isDebugEnabled()) {\n            LOGGER.debug(\"Moving job to deadletter job table {}\", job.getId());\n        }\n\n        DeadLetterJobEntity deadLetterJob = jobServiceConfiguration.getJobManager().moveJobToDeadLetterJob(job);\n\n        return deadLetterJob;","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/MoveJobToDeadLetterJobCmd.java#L30-L66","documentation":"MoveJobToDeadLetterJobCmd.execute() requires a jobId and throws FlowableIllegalArgumentException with message 'jobId and job is null' when it is null. The command looks up the job in the timer-job then job tables and moves it to the dead-letter table; a null id makes that impossible.","triggerScenarios":"Calling ManagementService.moveJobToDeadLetterJob(jobId) with a null jobId, or executing the command directly without an id.","commonSituations":"Job id read from a nullable event/variable; admin tooling sending an empty form field; retry scripts that pass null when the previous step failed.","solutions":["Validate jobId != null before calling moveJobToDeadLetterJob.","Guard batch move loops to skip null ids with a log entry.","Fix the upstream producer of the null id (query result, message payload)."],"exampleFix":"// before\nmanagementService.moveJobToDeadLetterJob(jobId);\n// after\nObjects.requireNonNull(jobId, \"jobId required\");\nmanagementService.moveJobToDeadLetterJob(jobId);","handlingStrategy":"validation","validationCode":"if (jobId == null || jobId.isEmpty()) throw new IllegalArgumentException(\"jobId required to move to dead-letter\");","typeGuard":"boolean hasId = jobId != null && !jobId.isEmpty();","tryCatchPattern":"try { managementService.moveJobToDeadLetterJob(jobId); } catch (FlowableIllegalArgumentException e) { log.error(\"Move failed: {}\", e.getMessage()); }","preventionTips":["Validate ids at the edge of your admin tooling","Skip-and-log null ids in loops","Use Optional<String> for job ids to force explicit handling"],"tags":["flowable","null-argument","deadletter-job","illegal-argument"],"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"}