fix: handle PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS error in p…#9059
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe ChangesForm Error Handling for Special Characters Validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR improves the project creation UX by mapping the API’s PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS validation error to a specific, localized toast message instead of falling back to a generic error.
Changes:
- Handle
PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERSin the project creation form error handler. - Add a new i18n translation key (
project_name_cannot_contain_special_characters) across supported locales. - Minor promise-chain adjustment to
return handleNextStep(res.id).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/ce/components/projects/create/root.tsx | Adds frontend handling for the new project-name special-character validation error code. |
| packages/i18n/src/locales/en/translations.ts | Adds English translation for the new toast message. |
| packages/i18n/src/locales/cs/translations.ts | Adds Czech translation for the new toast message. |
| packages/i18n/src/locales/de/translations.ts | Adds German translation for the new toast message. |
| packages/i18n/src/locales/es/translations.ts | Adds Spanish translation for the new toast message. |
| packages/i18n/src/locales/fr/translations.ts | Adds French translation for the new toast message. |
| packages/i18n/src/locales/id/translations.ts | Adds Indonesian translation for the new toast message. |
| packages/i18n/src/locales/it/translations.ts | Adds Italian translation for the new toast message. |
| packages/i18n/src/locales/ja/translations.ts | Adds Japanese translation for the new toast message. |
| packages/i18n/src/locales/ko/translations.ts | Adds Korean translation for the new toast message. |
| packages/i18n/src/locales/pl/translations.ts | Adds Polish translation for the new toast message. |
| packages/i18n/src/locales/pt-BR/translations.ts | Adds Brazilian Portuguese translation for the new toast message. |
| packages/i18n/src/locales/ro/translations.ts | Adds Romanian translation for the new toast message. |
| packages/i18n/src/locales/ru/translations.ts | Adds Russian translation for the new toast message. |
| packages/i18n/src/locales/sk/translations.ts | Adds Slovak translation for the new toast message. |
| packages/i18n/src/locales/tr-TR/translations.ts | Adds Turkish translation for the new toast message. |
| packages/i18n/src/locales/ua/translations.ts | Adds Ukrainian translation for the new toast message. |
| packages/i18n/src/locales/vi-VN/translations.ts | Adds Vietnamese translation for the new toast message. |
| packages/i18n/src/locales/zh-CN/translations.ts | Adds Simplified Chinese translation for the new toast message. |
| packages/i18n/src/locales/zh-TW/translations.ts | Adds Traditional Chinese translation for the new toast message. |
| @@ -136,6 +137,14 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre | |||
| message: t("project_identifier_already_taken"), | |||
| }); | |||
| } | |||
|
|
|||
| if (nameSpecialCharError) { | |||
| setToast({ | |||
| type: TOAST_TYPE.ERROR, | |||
| title: t("toast.error"), | |||
| message: t("project_name_cannot_contain_special_characters"), | |||
| }); | |||
| } | |||
There was a problem hiding this comment.
The identifier input already has frontend-level protection via projectIdentifierSanitizer in packages/utils/src/project.ts, which strips special characters on every keystroke before the value is stored in the form. This is wired up in apps/web/core/components/project/create/common-attributes.tsx via handleIdentifierChange. Special characters physically cannot be typed into the identifier field, so PROJECT_IDENTIFIER_CANNOT_CONTAIN_SPECIAL_CHARACTERS cannot be triggered from the project creation form.
However, since the backend API does handle this case in ProjectSerializer.validate_identifier(), I'm happy to add a defensive handler on the frontend as an extra safety layer if the maintainers feel it's necessary.
| project_created_successfully_description: "Project created successfully. You can now start adding work items to it.", | ||
| project_name_already_taken: "The project name is already taken.", | ||
| project_identifier_already_taken: "The project identifier is already taken.", | ||
| project_name_cannot_contain_special_characters: "Project name cannot contain special characters.", |
…roject creation form
4a25fe7 to
e1a9d29
Compare
|
I also got the same issue, thought of fixing it, then saw this PR. This seems to fix the issue, should be merged. |
Description
Root Cause:
In February 2026, PR #8529 added a
validate_name()method in the Django serializer (apps/api/plane/app/serializers/project.py) that raises aPROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERSvalidation error when a project name matches the forbidden characters pattern defined inapps/api/plane/db/models/project.py:The API returns this error code in the response, which reaches the frontend through the project service. However, the onSubmit catch block in apps/web/ce/components/projects/create/root.tsx only handled PROJECT_NAME_ALREADY_EXIST and PROJECT_IDENTIFIER_ALREADY_EXIST — the new error code was never handled, causing it to silently fall into the generic "Something went wrong" toast with no actionable feedback for the user.
Type of Change
Screenshots and Media (if applicable)
Before:


Generic "Something went wrong" toast shown when creating a project with special characters in the name.
After:
Specific and actionable error message "Project name cannot contain special characters." is now shown.
Test Scenarios
Project + TEST #) → now shows "Project name cannot contain special characters." ✅References
Closes #8969
Summary by CodeRabbit