UNIQUE_VIOLATION — composite unique key constraint violated
cyoda-go version 0.8.2
errors.UNIQUE_VIOLATION
Section titled “errors.UNIQUE_VIOLATION”UNIQUE_VIOLATION — a write was rejected because it would create a duplicate entry for a declared composite unique key.
SYNOPSIS
Section titled “SYNOPSIS”HTTP: 409 Conflict. Retryable: no.
DESCRIPTION
Section titled “DESCRIPTION”The entity payload contains field values that collide with an existing entity’s composite unique key. Unlike an optimistic-concurrency CONFLICT (which is retryable), a unique-key violation is a permanent data constraint — retrying the same payload without changing the key field values will produce the same result.
To resolve: change the values of the fields that form the unique key so they no longer duplicate an existing entity.
On write-time backends (PostgreSQL) this can also fire within one transaction when a value is claimed before its holder is freed; free-before-claim is portable (see cyoda help models).
SEE ALSO
Section titled “SEE ALSO”- errors
- errors.CONFLICT
- errors.INVALID_UNIQUE_KEY
See also
Section titled “See also”cyoda help errors— Every error response from the Cyoda REST API carries a structurederrorCodein thepropertiesobject. Multiple codes may share the same HTTP status. Programmatic handling keys onerrorCode, not HTTP status.cyoda help errors CONFLICT— The server detected that the entity was modified by another writer between the time it was read and the time the current write was committed. Normal outcome under concurrent load.cyoda help errors INVALID_UNIQUE_KEY— A composite unique key requires every declared field to be present and non-null. This error is returned when the entity payload is missing a value for at least one key field, or the value cannot be normalized to a valid claim (for example, a NaN or ±Infinity for a numeric key field).
Raw formats
Section titled “Raw formats”/help/errors/unique_violation.json— full descriptor (matchesGET /help/{topic}envelope)/help/errors/unique_violation.md— body only