apache/dolphinscheduler · error · ServiceException

10001

10001

Error message

request parameter {tenantCode} is not valid

What it means

Status.REQUEST_PARAMS_NOT_VALID_ERROR from TenantServiceImpl.createTenantValid: the tenantCode (OS tenant / Linux user name) submitted to create a tenant is empty. DolphinScheduler tenants map to Linux users on worker nodes, so the code is a mandatory identifier and cannot be blank.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java:88

    private WorkflowInstanceDao workflowInstanceDao;

    @Autowired
    private ScheduleDao scheduleDao;

    @Autowired
    private UserDao userDao;

    @Autowired
    private QueueService queueService;

    /**
     * Check the tenant new object valid or not
     *
     * @param tenant The tenant object want to create
     */
    private void createTenantValid(Tenant tenant) throws ServiceException {
        if (StringUtils.isEmpty(tenant.getTenantCode())) {
            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, tenant.getTenantCode());
        } else if (StringUtils.length(tenant.getTenantCode()) > TENANT_FULL_NAME_MAX_LENGTH) {
            throw new ServiceException(Status.TENANT_FULL_NAME_TOO_LONG_ERROR);
        } else if (!RegexUtils.isValidLinuxUserName(tenant.getTenantCode())) {
            throw new ServiceException(Status.CHECK_OS_TENANT_CODE_ERROR);
        } else if (checkTenantExists(tenant.getTenantCode())) {
            throw new ServiceException(Status.OS_TENANT_CODE_EXIST, tenant.getTenantCode());
        }
    }

    /**
     * Check tenant update object valid or not
     *
     * @param existsTenant The exists queue object
     * @param updateTenant The queue object want to update
     */
    private void updateTenantValid(Tenant existsTenant, Tenant updateTenant) throws ServiceException {
        // Check the exists tenant
        if (Objects.isNull(existsTenant)) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Provide a non-empty tenantCode in the request body.
  2. Validate tenantCode client-side before calling the API (non-null, non-blank).
  3. Fix template/CI variable substitution so ${TENANT} is populated.
  4. Use the UI create-tenant form, which enforces the field, if scripting is not required.

Example fix

// before
curl -X POST .../tenants -d '{"tenantCode":"", "queueId":1}'
// after
curl -X POST .../tenants -d '{"tenantCode":"ds_tenant01", "queueId":1}'
Defensive patterns

Strategy: validation

Validate before calling

if (tenantCode == null || tenantCode.trim().isEmpty()) {
    throw new IllegalArgumentException("tenantCode is required");
}

Type guard

boolean validTenantCodeInput(String s) { return s != null && !s.isBlank(); }

Try / catch

try {
    tenantService.createTenant(loginUser, tenantCode, desc, queueId);
} catch (ServiceException e) {
    if (e.getCode() == 10001) { /* fix request payload: tenantCode missing/empty */ }
}

Prevention

When it happens

Trigger: POST /tenants with an empty or missing tenantCode field, or UI form submitting a blank tenant code.

Common situations: Automation templates with unbound variables (empty ${TENANT}); UI form validation bypassed by direct API calls; JSON body missing the tenantCode key entirely.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/7b75f48328b51ac4. Report an issue: GitHub.