Skip to content

POST /api/endpoint – Duplicate name error does not specify the conflicting name in the name field #112

Open
@sagarkumar-webkul

Description

@sagarkumar-webkul

API Issue Report


Title

POST /api/endpoint – Duplicate name error does not specify the conflicting name in the name field


Description

When trying to create or update a resource with an already existing name, the API returns the same generic message ("The name has already been taken.") in both the top-level message and under the errors.name field. However, in the errors.name field, the response should ideally include the exact conflicting name value or a more descriptive message to clarify which name has already been taken.

This will help end users and developers identify the conflict without guessing.

Steps to Reproduce

  1. Send a POST request to the API endpoint with a name field that already exists in the system.
  2. Observe the response body:
    {
      "message": "The name has already been taken.",
      "errors": {
        "name": [
          "The name has already been taken."
        ]
      }
    }

Expected Result

  • The errors.name field should indicate which name is causing the duplication.
    Example:
    "errors": {
      "name": [
        "The name 'example_name' has already been taken."
      ]
    }

Actual Result

  • Both message and errors.name return the same generic message without identifying the conflicting name.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions