Fix a refused write

Fix a create or an update that Marfa refuses.

Marfa refuses a write it can't apply safely, and changes nothing. The answer's code, message and details say why. Find the code here; Write safely explains the rules behind the first three.

409 version_conflict

Version 1 is stale; current version is 2. Conflicting fields: title.

Your update changed a field that someone else changed since the version you read, so Marfa refused it rather than overwrite theirs. The answer holds the item now in current, the version you read in ancestor and the fields both changed in conflicting_fields. Settle the conflict yourself, or send the update with conflict=auto to let Marfa settle it.

409 ancestor_unavailable

No snapshot of version 99 is available to this write, so it cannot be merged. Re-read the item at version 3 and re-apply the change.

Marfa keeps no snapshot of the version your update names, so it can't tell what changed since. Housekeeping thins old snapshots, and a version that never existed has none. Read the item again and apply your change to it, as When Marfa no longer holds your version says.

400 missing_required_field: version is required

An update must name the version it read, so Marfa can tell whether the item changed in between. details.field is version.

Read the item, and send its version with the update.

400 validation_error: Send the body as JSON

The full message is Send the body as JSON, with Content-Type: application/json. The request has a body but no JSON content type.

Add the header. With curl, that's -H "Content-Type: application/json".

400 validation_error: The query names parameters this operation does not take

The request names a query parameter the operation doesn't take, often a misspelled filter, and details.unknown_parameters lists each one. Marfa refuses it so that a typo can't return everything.

Correct the name. Marfa ignores a parameter whose name starts with _, so use that for one of your own, such as a cache buster.

400 validation_error: The body holds text that is not well-formed

The message ends a surrogate escape has no partner. A string or a property name in the body holds half of a character that takes two UTF-16 code units, such as an emoji cut in the middle, which UTF-8 can't carry. details.errors[].path names the text by its JSON pointer.

Cut text between characters, not between code units. In JavaScript, isWellFormed() checks a string, and toWellFormed() replaces each stray half with U+FFFD.

400 invalid_properties

The item's properties don't fit its type: a required field is missing, or a value has the wrong shape. details.errors names each field and what's wrong with it, such as title: Required field is missing.

Read the type's fields with marfa types get <type>, and send what it asks for. Field kinds gives each kind's rules. Two of them refuse values that look valid:

  • A whole number Marfa can't serve back with the same digits, such as 1500000000000000001. The message starts Must be a whole number that Marfa serves back with the same digits, and names the number it would serve instead. An integer field takes a whole number from -9007199254740991 to 9007199254740991, so send a larger one as a string.
  • A url value the WHATWG URL Standard refuses, such as https://exa mple.com. The message is url: Must be a valid URL.

On this page