Skip to content

fix: handle PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS error in p…#9059

Open
durgeshhhhhhh wants to merge 1 commit into
makeplane:previewfrom
durgeshhhhhhh:fix/project-name-special-char-error-handling
Open

fix: handle PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS error in p…#9059
durgeshhhhhhh wants to merge 1 commit into
makeplane:previewfrom
durgeshhhhhhh:fix/project-name-special-char-error-handling

Conversation

@durgeshhhhhhh
Copy link
Copy Markdown

@durgeshhhhhhh durgeshhhhhhh commented May 12, 2026

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 a PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS validation error when a project name matches the forbidden characters pattern defined in apps/api/plane/db/models/project.py:

FORBIDDEN_IDENTIFIER_CHARS_PATTERN = r"^.*[&+,:;$^}{*=?@#|'<>.()%!-].*$"

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

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Before:
Generic "Something went wrong" toast shown when creating a project with special characters in the name.
Screenshot 2026-05-08 at 5 19 10 PM
After:
Specific and actionable error message "Project name cannot contain special characters." is now shown.
Screenshot 2026-05-12 at 9 54 20 PM

Test Scenarios

  1. Create a project with special characters in the name (e.g. Project + TEST #) → now shows "Project name cannot contain special characters." ✅
  2. Create a project with a duplicate name → still shows "Project name already taken" ✅
  3. Create a project with a duplicate identifier → still shows "Project identifier already taken" ✅
  4. Create a valid project → creates successfully ✅

References

Closes #8969

Summary by CodeRabbit

  • Bug Fixes
    • Fixed project creation form to properly advance to the next step after successful project creation.
    • Improved error messaging when project names contain special characters, providing clearer feedback to users encountering validation errors.

Review Change Stack

Copilot AI review requested due to automatic review settings May 12, 2026 16:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d78fd7ca-628e-4ba2-b892-9d83b2494fe8

📥 Commits

Reviewing files that changed from the base of the PR and between 4a25fe7 and e1a9d29.

📒 Files selected for processing (1)
  • apps/web/ce/components/projects/create/root.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/ce/components/projects/create/root.tsx

📝 Walkthrough

Walkthrough

The CreateProjectForm component now properly handles backend validation errors when project names contain special characters. It detects the specific error code, sets a flag, and displays a dedicated localized toast message. The form also returns immediately after successful project creation to ensure proper navigation to the next step.

Changes

Form Error Handling for Special Characters Validation

Layer / File(s) Summary
Form error detection and display for special characters
apps/web/ce/components/projects/create/root.tsx
Success handler returns the handleNextStep(res.id) call to properly advance to the next step. Error detection derives a nameSpecialCharError flag from backend error matching PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS. Toast message display handles the new flag to show a dedicated localized validation message for special characters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A form that caught what slipped before,
Now flags the + with grace and lore—
Sweet toasts bloom in tongues diverse,
No crash shall haunt each character curse! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding handling for the PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS error.
Description check ✅ Passed The description is well-structured, includes root cause analysis, type of change, before/after screenshots, comprehensive test scenarios, and issue reference.
Linked Issues check ✅ Passed The PR addresses issue #8969 by handling the PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS error and showing a specific validation message instead of a generic error.
Out of Scope Changes check ✅ Passed The changes are scoped to the project creation form and error handling, directly addressing the issue without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 12, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_CHARACTERS in 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.

Comment on lines 120 to +147
@@ -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"),
});
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.",
@durgeshhhhhhh durgeshhhhhhh force-pushed the fix/project-name-special-char-error-handling branch from 4a25fe7 to e1a9d29 Compare May 15, 2026 08:20
@Rahban1
Copy link
Copy Markdown

Rahban1 commented May 17, 2026

I also got the same issue, thought of fixing it, then saw this PR. This seems to fix the issue, should be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project creation silently fails with React crash when name/identifier contains special characters

4 participants