{"record":{"id":"7b75f48328b51ac4","repo":"apache/dolphinscheduler","slug":"10001-7b75f4","errorCode":"10001","errorMessage":"request parameter {tenantCode} is not valid","messagePattern":"request parameter (.+?) is not valid","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java","lineNumber":88,"sourceCode":"    private WorkflowInstanceDao workflowInstanceDao;\n\n    @Autowired\n    private ScheduleDao scheduleDao;\n\n    @Autowired\n    private UserDao userDao;\n\n    @Autowired\n    private QueueService queueService;\n\n    /**\n     * Check the tenant new object valid or not\n     *\n     * @param tenant The tenant object want to create\n     */\n    private void createTenantValid(Tenant tenant) throws ServiceException {\n        if (StringUtils.isEmpty(tenant.getTenantCode())) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, tenant.getTenantCode());\n        } else if (StringUtils.length(tenant.getTenantCode()) > TENANT_FULL_NAME_MAX_LENGTH) {\n            throw new ServiceException(Status.TENANT_FULL_NAME_TOO_LONG_ERROR);\n        } else if (!RegexUtils.isValidLinuxUserName(tenant.getTenantCode())) {\n            throw new ServiceException(Status.CHECK_OS_TENANT_CODE_ERROR);\n        } else if (checkTenantExists(tenant.getTenantCode())) {\n            throw new ServiceException(Status.OS_TENANT_CODE_EXIST, tenant.getTenantCode());\n        }\n    }\n\n    /**\n     * Check tenant update object valid or not\n     *\n     * @param existsTenant The exists queue object\n     * @param updateTenant The queue object want to update\n     */\n    private void updateTenantValid(Tenant existsTenant, Tenant updateTenant) throws ServiceException {\n        // Check the exists tenant\n        if (Objects.isNull(existsTenant)) {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java#L70-L106","documentation":"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.","triggerScenarios":"POST /tenants with an empty or missing tenantCode field, or UI form submitting a blank tenant code.","commonSituations":"Automation templates with unbound variables (empty ${TENANT}); UI form validation bypassed by direct API calls; JSON body missing the tenantCode key entirely.","solutions":["Provide a non-empty tenantCode in the request body.","Validate tenantCode client-side before calling the API (non-null, non-blank).","Fix template/CI variable substitution so ${TENANT} is populated.","Use the UI create-tenant form, which enforces the field, if scripting is not required."],"exampleFix":"// before\ncurl -X POST .../tenants -d '{\"tenantCode\":\"\", \"queueId\":1}'\n// after\ncurl -X POST .../tenants -d '{\"tenantCode\":\"ds_tenant01\", \"queueId\":1}'","handlingStrategy":"validation","validationCode":"if (tenantCode == null || tenantCode.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"tenantCode is required\");\n}","typeGuard":"boolean validTenantCodeInput(String s) { return s != null && !s.isBlank(); }","tryCatchPattern":"try {\n    tenantService.createTenant(loginUser, tenantCode, desc, queueId);\n} catch (ServiceException e) {\n    if (e.getCode() == 10001) { /* fix request payload: tenantCode missing/empty */ }\n}","preventionTips":["Always send tenantCode explicitly in API payloads","Validate required fields client-side before POST","Check CI/template variable substitution","Use the UI form which enforces the field"],"tags":["validation","tenant","empty-parameter","api"],"backgroundTag":"empty-required-field","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}