{"record":{"id":"19028bcc470f1f19","repo":"flowable/flowable-engine","slug":"the-job-id-is-mandatory-but-jobid-has-been-p","errorCode":null,"errorMessage":"The job id is mandatory, but '${jobId}' has been provided.","messagePattern":"The job id is mandatory, but '(.+?)' has been provided\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/SetJobRetriesCmd.java","lineNumber":43,"sourceCode":"import org.flowable.job.service.JobServiceConfiguration;\nimport org.flowable.job.service.event.impl.FlowableJobEventBuilder;\nimport org.flowable.job.service.impl.persistence.entity.JobEntity;\n\n/**\n * @author Falko Menge\n */\npublic class SetJobRetriesCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    \n    protected JobServiceConfiguration jobServiceConfiguration;\n\n    protected final String jobId;\n    protected final int retries;\n\n    public SetJobRetriesCmd(String jobId, int retries, JobServiceConfiguration jobServiceConfiguration) {\n        if (jobId == null || jobId.length() < 1) {\n            throw new FlowableIllegalArgumentException(\"The job id is mandatory, but '\" + jobId + \"' has been provided.\");\n        }\n        if (retries < 0) {\n            throw new FlowableIllegalArgumentException(\"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        this.jobServiceConfiguration = jobServiceConfiguration;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        JobEntity job = jobServiceConfiguration.getJobEntityManager().findById(jobId);\n        if (job != null) {\n\n            job.setRetries(retries);\n\n            FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();\n            if (eventDispatcher != null && eventDispatcher.isEnabled()) {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/SetJobRetriesCmd.java#L25-L61","documentation":"The SetJobRetriesCmd constructor validates that jobId is non-null and non-empty before storing it, throwing FlowableIllegalArgumentException when the id is null or zero-length. Setting the retry count of a job is meaningless without identifying the job, so the command fails fast at construction time.","triggerScenarios":"Calling ManagementService.setJobRetries(jobId, retries) (or new SetJobRetriesCmd(...)) with jobId == null or \"\".","commonSituations":"Empty string from a blank UI/config field; null id from a map lookup or optional job reference; retry scripts that iterate jobs with missing ids.","solutions":["Check jobId is non-null and not blank before calling setJobRetries.","Filter out null/empty ids in batch retry operations.","Fix the producer of the empty/null job id (form, query, message)."],"exampleFix":"// before\nmanagementService.setJobRetries(jobId, 3);\n// after\nif (jobId != null && !jobId.trim().isEmpty()) {\n    managementService.setJobRetries(jobId, 3);\n}","handlingStrategy":"validation","validationCode":"if (jobId == null || jobId.trim().isEmpty()) throw new IllegalArgumentException(\"jobId is mandatory\");","typeGuard":"boolean validJobId = jobId != null && jobId.length() > 0;","tryCatchPattern":"try { managementService.setJobRetries(jobId, retries); } catch (FlowableIllegalArgumentException e) { log.error(\"setJobRetries rejected: {}\", e.getMessage()); }","preventionTips":["Trim and check job ids from forms/config before use","Reject empty strings as well as null","Centralize id validation in a utility method"],"tags":["flowable","empty-required-field","job-retries","illegal-argument"],"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-18T16:17:23.245Z"}