{"record":{"id":"67df8ba48d031cb1","repo":"flowable/flowable-engine","slug":"the-job-id-is-mandatory-but-jobid-has-b","errorCode":null,"errorMessage":"The job id is mandatory, but '\" + jobId + \"' has been provided.","messagePattern":"The job id is mandatory, but '\" \\+ jobId \\+ \"' has been provided\\.","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SetJobRetriesCmd.java","lineNumber":40,"sourceCode":"import org.activiti.engine.impl.interceptor.CommandContext;\nimport org.activiti.engine.impl.persistence.entity.JobEntity;\nimport org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;\nimport org.flowable.common.engine.impl.interceptor.EngineConfigurationConstants;\nimport org.flowable.job.api.Job;\n\n/**\n * @author Falko Menge\n */\npublic class SetJobRetriesCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    private final String jobId;\n    private final int retries;\n\n    public SetJobRetriesCmd(String jobId, int retries) {\n        if (jobId == null || jobId.length() < 1) {\n            throw new ActivitiIllegalArgumentException(\"The job id is mandatory, but '\" + jobId + \"' has been provided.\");\n        }\n        if (retries < 0) {\n            throw new ActivitiIllegalArgumentException(\"The number of job retries must be a non-negative Integer, but '\" + retries + \"' has been provided.\");\n        }\n        this.jobId = jobId;\n        this.retries = retries;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        JobEntity job = commandContext\n                .getJobEntityManager()\n                .findJobById(jobId);\n        if (job != null) {\n            job.setRetries(retries);\n\n            if (commandContext.getEventDispatcher().isEnabled()) {\n                commandContext.getEventDispatcher().dispatchEvent(","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SetJobRetriesCmd.java#L22-L58","documentation":"Constructor validation in flowable5 SetJobRetriesCmd: the jobId is null or an empty string, but it is mandatory for setting a job's retry count; the offending value is interpolated in the message.","triggerScenarios":"new SetJobRetriesCmd(null, retries) or new SetJobRetriesCmd(\"\", retries), e.g. via ManagementService.setJobRetries(null, n).","commonSituations":"Job id taken from a job that failed to load, an unbound variable in scripts, or a form/config field left empty before calling setJobRetries.","solutions":["Pass a valid job id obtained from ManagementService.createJobQuery() or the timer/deadletter job tables.","Validate jobId non-null and non-empty at the call site before constructing the command.","Fix upstream code that produces the empty id (e.g. missing request parameter)."],"exampleFix":"// before\nmanagementService.setJobRetries(jobId, 3); // jobId may be null/empty\n// after\nif (jobId != null && !jobId.isEmpty()) {\n    managementService.setJobRetries(jobId, 3);\n}","handlingStrategy":"validation","validationCode":"if (jobId == null || jobId.trim().isEmpty()) throw new IllegalArgumentException(\"jobId required\");","typeGuard":null,"tryCatchPattern":"try { managementService.setJobRetries(jobId, retries); }\ncatch (ActivitiIllegalArgumentException e) { log.error(\"invalid jobId '{}'\", jobId); }","preventionTips":["Fetch job ids from createJobQuery() results","Validate request parameters before mapping to commands","Never pass empty strings where ids are required"],"tags":["job","illegal-argument","validation","empty-string"],"backgroundTag":"empty-required-field","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"}