---
title: "Reject a duplicate name without changing the original"
description: "Verify server-enforced uniqueness using an existing test record, then recover with a distinct name and confirm both saved objects."
canonical_url: "https://vostride.com/agent-library/forms-validation/duplicate-unique-name.md"
md_url: "https://vostride.com/agent-library/forms-validation/duplicate-unique-name.md"
content_kind: "recipe"
topic: "forms-validation"
---

# Reject a duplicate name without changing the original

Verify server-enforced uniqueness using an existing test record, then recover with a distinct name and confirm both saved objects.

## Risk

A client can optimistically display a new object even when the server rejects its duplicate key. A uniqueness test must preserve and inspect the original object as well as the proposed replacement.

## Fixtures

- A test workspace contains a label named Release lane with description Original fixture description.
- Label names are unique within a workspace under the application contract.
- A separate intended label name Release lane secondary is absent from the seed inventory.

## Steps

1. Open Create label and enter Release lane with description Attempted duplicate description.
2. Submit and verify a visible duplicate-name error while the creation form remains editable.
3. Open the existing label through a separate normal UI route and verify its original description has not changed.
4. Return to the rejected form or start an equivalent draft, change the name to Release lane secondary, and submit.
5. Verify the new label has the attempted description, the original label retains its original description, and the workspace lists exactly the two expected label keys.

## Expected results

- The duplicate attempt does not overwrite the existing label description or identifier.
- The recovered submission produces a new identifier attached to the distinct allowed name.
- An independent fixture inventory or verification hook reports one record per final name.

## False-pass traps

- A duplicate error can coexist with an unintended update to the original object; inspect both records.
- A list showing two similar labels does not prove uniqueness unless exact names and identifiers are checked.

## Cleanup

- Delete the secondary label and the original test-owned label by identifier.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa first test](/docs/agent-qa/guides/first-test.md)
- [agent-qa web testing](/docs/agent-qa/guides/web-testing.md)

- [Forms and validation QA recipes](/agent-library/forms-validation.md)
- [Software factory QA library](/agent-library.md)
