{"record":{"id":"df974cdd92fa0753","repo":"flowable/flowable-engine","slug":"worker-id-must-not-be-empty","errorCode":null,"errorMessage":"worker id must not be empty","messagePattern":"worker id must not be empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/UnacquireAllExternalWorkerJobsForWorkerCmd.java","lineNumber":40,"sourceCode":"import org.flowable.job.service.impl.persistence.entity.ExternalWorkerJobEntity;\nimport org.flowable.job.service.impl.persistence.entity.ExternalWorkerJobEntityManager;\n\npublic class UnacquireAllExternalWorkerJobsForWorkerCmd implements Command<Void> {\n\n    protected final String workerId;\n    protected final String tenantId;\n    protected final JobServiceConfiguration jobServiceConfiguration;\n\n    public UnacquireAllExternalWorkerJobsForWorkerCmd(String workerId, String tenantId, JobServiceConfiguration jobServiceConfiguration) {\n        this.workerId = workerId;\n        this.tenantId = tenantId;\n        this.jobServiceConfiguration = jobServiceConfiguration;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (StringUtils.isEmpty(workerId)) {\n            throw new FlowableIllegalArgumentException(\"worker id must not be empty\");\n        }\n\n        ExternalWorkerJobEntityManager externalWorkerJobEntityManager = jobServiceConfiguration.getExternalWorkerJobEntityManager();\n\n        List<ExternalWorkerJobEntity> jobEntities = externalWorkerJobEntityManager.findJobsByWorkerId(workerId);\n        \n        if (!jobEntities.isEmpty()) {\n            if (StringUtils.isNotEmpty(tenantId)) {\n                for (ExternalWorkerJobEntity externalWorkerJob : jobEntities) {\n                    if (!tenantId.equals(externalWorkerJob.getTenantId())) {\n                        throw new FlowableIllegalArgumentException(\"provided worker id has external worker jobs from different tenant.\");\n                    }\n                }\n            }\n            \n            for (ExternalWorkerJobEntity externalWorkerJob : jobEntities) {\n                if (externalWorkerJob.isExclusive()) {\n                    new UnlockExclusiveJobCmd(externalWorkerJob, jobServiceConfiguration).execute(commandContext);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/UnacquireAllExternalWorkerJobsForWorkerCmd.java#L22-L58","documentation":"UnacquireAllExternalWorkerJobsForWorkerCmd.execute throws this FlowableIllegalArgumentException when workerId is null or empty. The command needs a worker id to find and release all externally acquired jobs belonging to that worker, so an empty id makes the operation impossible. It is fail-fast validation before querying the external worker job entity manager.","triggerScenarios":"Calling JobService/unacquireAllExternalWorkerJobsForWorker(workerId, tenantId) with workerId null or \"\"; a worker client whose id was never configured (missing worker-id property) invoking cleanup on shutdown.","commonSituations":"External worker configuration where the worker id property is missing or blank; passing a variable initialized from a failed lookup; code refactoring dropped the assignment of the worker id.","solutions":["Configure a stable, non-empty worker id before starting the external worker","Guard the call site: only call unacquire when workerId is present","Fix config/property loading that yields an empty worker id"],"exampleFix":"// before\nexternalWorkerJobService.unacquireAllExternalWorkerJobsForWorker(workerId, tenantId);\n// after\nif (workerId != null && !workerId.isBlank()) {\n    externalWorkerJobService.unacquireAllExternalWorkerJobsForWorker(workerId, tenantId);\n} else {\n    logger.warn(\"Skip unacquire: worker id not set\");\n}","handlingStrategy":"validation","validationCode":"if (workerId == null || workerId.isBlank()) {\n    throw new IllegalStateException(\"worker id must be configured before unacquire\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set a persistent non-empty worker id in external worker configuration","Fail fast at startup if the worker id is missing","Only call shutdown-cleanup paths after identity is initialized"],"tags":["validation","flowable","external-worker"],"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"}