Skip to content
Settings

PRECONDITION_REQUIRED — PATCH request missing required If-Match header

cyoda-go version 0.8.2

PRECONDITION_REQUIRED — a PATCH request was submitted without an If-Match header, which is mandatory for patch operations.

HTTP: 428 Precondition Required. Retryable: no.

PATCH applies a merge patch to the entity’s stored state rather than replacing it wholesale. Because the patch is applied relative to the current stored data, cyoda-go requires the caller to state a precondition explicitly via If-Match. Omitting the header entirely is rejected.

This behaviour is specific to PATCH. A PUT without If-Match is treated as an unconditional replace and is accepted.

Not retryable as-is — the same request without an If-Match header produces the same error.

Add an If-Match header to the PATCH request. Two modes are supported:

  • Conditional patch — supply the transactionId obtained from your most recent GET of the entity as the If-Match value. The patch is applied only if the entity has not changed since that read; a 412 ENTITY_MODIFIED is returned if another writer has committed in the meantime.
  • Unconditional patch (last-writer-wins) — supply If-Match: * to explicitly accept that the patch will be applied to whatever the current stored state is, without a version check.

Choose the conditional form when you need to detect concurrent modifications; choose * when you intentionally want last-writer-wins semantics and have already decided the patch is safe to apply regardless of concurrent changes.

  • errors
  • errors.ENTITY_MODIFIED
  • errors.BAD_REQUEST
  • cyoda help errors — Every error response from the Cyoda REST API carries a structured errorCode in the properties object. Multiple codes may share the same HTTP status. Programmatic handling keys on errorCode, not HTTP status.
  • cyoda help errors ENTITY_MODIFIED — When an entity update request carries an If-Match header, the server requires the supplied transaction ID to equal the entity’s current meta.transactionId. A mismatch means another writer has updated the entity since the caller’s last read. The optimistic-concurrency guard rejects the update rather than silently overwrite.
  • cyoda help errors BAD_REQUEST — Fired when the server cannot parse or structurally process the incoming request. Common triggers include invalid JSON, missing required fields, unsupported format specifiers, or mutually exclusive parameters being set simultaneously.