--name option for the create-tenant command does not take effect #7352

Closed
opened 2026-02-21 18:20:09 -05:00 by yindo · 1 comment
Owner

Originally created by @euxx on GitHub (Dec 23, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

v0.14.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

cd api
poetry run python -m flask create-tenant --email 'admin@local.com' --name "Custom Tenant" --language 'zh-Hans'

✔️ Expected Behavior

Will create a new tenant with name Custom Tenant.

Actual Behavior

Will create a new tenant with name admin's Workspace:

image
Originally created by @euxx on GitHub (Dec 23, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version v0.14.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ```sh cd api poetry run python -m flask create-tenant --email 'admin@local.com' --name "Custom Tenant" --language 'zh-Hans' ``` ### ✔️ Expected Behavior Will create a new tenant with name `Custom Tenant`. ### ❌ Actual Behavior Will create a new tenant with name `admin's Workspace`: <img width="718" alt="image" src="https://github.com/user-attachments/assets/39f848e3-e22b-4706-90fe-abc3311f7836" />
yindo added the 🐞 bug label 2026-02-21 18:20:09 -05:00
yindo closed this issue 2026-02-21 18:20:09 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 23, 2024):

@euxx Hello there! I'm here to help you with bug fixes, answer your questions, and even guide you on becoming a contributor. Let's squash those bugs together! 😉

The issue you're experiencing with the --name option not taking effect in the create-tenant command could be related to how the name parameter is processed and validated. Here are a few points to consider:

  1. Validation and Encoding: The name parameter is validated and encoded for non-Latin characters using UTF-8. Ensure that the name you are providing is correctly encoded and does not contain any invalid characters that might cause it to be ignored or defaulted [1].

  2. Default Fallback: If the name parameter is not correctly processed, the system defaults to using the account's name followed by "'s Workspace" as the tenant name. This is consistent with the behavior you're observing [2].

  3. Function Implementation: The TenantService.create_owner_tenant_if_not_exist function checks if a name is provided and uses it to create the tenant. If not, it defaults to the account's name. Ensure that this function is being called with the correct parameters and that no logic is overriding the provided name [2].

To troubleshoot further, you might want to add logging or debug statements to verify that the name parameter is being passed and processed correctly throughout the command execution. Additionally, check for any recent changes or issues in the codebase that might affect this functionality.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Dec 23, 2024): <!-- Greeting --> @euxx Hello there! I'm here to help you with bug fixes, answer your questions, and even guide you on becoming a contributor. Let's squash those bugs together! 😉 <!-- Answer --> The issue you're experiencing with the `--name` option not taking effect in the `create-tenant` command could be related to how the `name` parameter is processed and validated. Here are a few points to consider: 1. **Validation and Encoding**: The `name` parameter is validated and encoded for non-Latin characters using UTF-8. Ensure that the name you are providing is correctly encoded and does not contain any invalid characters that might cause it to be ignored or defaulted <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/commands.py)</sup>. 2. **Default Fallback**: If the `name` parameter is not correctly processed, the system defaults to using the account's name followed by "'s Workspace" as the tenant name. This is consistent with the behavior you're observing <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/services/account_service.py)</sup>. 3. **Function Implementation**: The `TenantService.create_owner_tenant_if_not_exist` function checks if a name is provided and uses it to create the tenant. If not, it defaults to the account's name. Ensure that this function is being called with the correct parameters and that no logic is overriding the provided name <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/services/account_service.py)</sup>. To troubleshoot further, you might want to add logging or debug statements to verify that the `name` parameter is being passed and processed correctly throughout the command execution. Additionally, check for any recent changes or issues in the codebase that might affect this functionality. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/68933a86-9600-4700-b3be-a0eed694694c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/68933a86-9600-4700-b3be-a0eed694694c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/68933a86-9600-4700-b3be-a0eed694694c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/68933a86-9600-4700-b3be-a0eed694694c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/68933a86-9600-4700-b3be-a0eed694694c?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/68933a86-9600-4700-b3be-a0eed694694c?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7352