Skip to content

Incorrect exception message when attempting to create project with duplicate labels #4777

@leoll2

Description

@leoll2

Steps to reproduce

  1. Try to create a Geti Tune project with two labels that have the same name

This is equivalent to submitting this request (note the duplicate labels):

curl -s -x POST localhost:7860/api/projects -H "Content-Type: application/json" --data '{ "name": "animals", "task": { "task_type": "classification", "exclusive_labels": true, "labels": [ { "name": "cat" }, { "name": "cat" } ] } }'

Expected behavior

The request is rejected with error 404 or 409, with a message that indicates the duplicate label

Actual behavior

The request is rejected with a misleading message:

{"detail":"Project with name 'animals' already exists."}

The project name is not duplicated, the label names are (within the request). This issue is probably caused by how integrity errors raised by children entities are handled and propagated to the parent:

raise ResourceAlreadyExistsError(self.config.resource_type, getattr(item, "name", str(item.id))) # type: ignore[attr-defined]

Metadata

Metadata

Assignees

Labels

Geti Tune BackendIssues related to Geti Tune Studio backend

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions