{"record":{"id":"eaa2d48b98b54349","repo":"apache/dolphinscheduler","slug":"there-is-no-usergroup-exist-cannot-create-tenant","errorCode":null,"errorMessage":"There is no userGroup exist cannot create tenant, please create userGroupFirst","messagePattern":"There is no userGroup exist cannot create tenant, please create userGroupFirst","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java","lineNumber":203,"sourceCode":"     */\n    public static synchronized void createUserIfAbsent(String userName) {\n        // if not exists this user, then create\n        if (!getUserList().contains(userName)) {\n            createUser(userName);\n        }\n    }\n\n    /**\n     * create user\n     *\n     * @param userName user name\n     * @return true if creation was successful, otherwise false\n     */\n    public static void createUser(String userName) {\n        try {\n            String userGroup = getGroup();\n            if (StringUtils.isEmpty(userGroup)) {\n                throw new UnsupportedOperationException(\n                        \"There is no userGroup exist cannot create tenant, please create userGroupFirst\");\n            }\n            if (SystemUtils.IS_OS_MAC) {\n                createMacUser(userName, userGroup);\n            } else if (SystemUtils.IS_OS_WINDOWS) {\n                createWindowsUser(userName, userGroup);\n            } else {\n                createLinuxUser(userName, userGroup);\n            }\n            log.info(\"Create tenant {} under userGroup: {} success\", userName, userGroup);\n        } catch (Exception e) {\n            throw new RuntimeException(\"Create tenant: {} failed\", e);\n        }\n\n    }\n\n    /**\n     * create linux user","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java#L185-L221","documentation":"OSUtils.createUser creates an OS-level tenant user and assigns it to the primary user group returned by getGroup(). If the group lookup returns null/empty (no user group resolvable on this machine), an UnsupportedOperationException is thrown telling the operator to create the group first, because a user cannot be created without a group.","triggerScenarios":"Calling createUser / createUserIfAbsent on a machine where getGroup() returns empty — e.g. Linux host with no 'admin'-style group matching the lookup logic, unusual /etc/group, or running under an account whose primary group cannot be determined.","commonSituations":"Fresh minimal Linux servers or containers (e.g. slim Docker images) lacking expected groups; worker nodes where tenant auto-creation is enabled but the OS has no suitable group; macOS/Windows edge cases.","solutions":["Create the expected user group on the host before starting the worker (e.g. 'groupadd <expected-group>')","Verify the account running DolphinScheduler can read /etc/group and has permission to create users","Disable automatic tenant/user creation and provision OS users manually"],"exampleFix":"// before (on the worker host)\n# no group exists -> createUser throws\n// after\nsudo groupadd workers && sudo usermod -aG workers $USER","handlingStrategy":"validation","validationCode":"String group = OSUtils.getGroup();\nif (StringUtils.isEmpty(group)) {\n    throw new IllegalStateException(\"No user group available; create one before creating tenants\");\n}","typeGuard":null,"tryCatchPattern":"try { OSUtils.createUser(userName); } catch (UnsupportedOperationException e) { log.error(\"Missing user group: provision the group first\", e); }","preventionTips":["Ensure the expected group exists on every worker host before startup","Run workers on images that include standard user/group tools","Provision OS users manually instead of relying on auto-creation in restricted environments"],"tags":["os","users","tenant","linux"],"backgroundTag":"missing-credentials","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}