Docs / EventSourcingDB / Errors / event-hash-malformed

event-hash-malformed

The hash of an anchor is not a valid hash.

  • Routes: create-backup and audit-history
  • Description: event hash is malformed: expected 64 lowercase hexadecimal digits, prefixed with 'esdb:hash:v2:' for a hash of version 2
  • Details: value, the hash as the request gave it.

Why It Happens#

The hash of an anchor, lastBackedUpEvent for an incremental backup or lastAuditedEvent for an audit, is the hash of an event as EventSourcingDB answered it: 64 lowercase hexadecimal digits, with the prefix esdb:hash:v2: for a hash of version 2, and without a prefix for a hash of version 1, which predates it. A hash with uppercase digits, one that is cut short, or one with another prefix is refused.

How to Fix It#

Send the hash exactly as EventSourcingDB answered it, without changing its case or cutting it. Sending the same request again fails the same way.

Example#

For an audit whose lastAuditedEvent has the hexadecimal digits of its hash in uppercase, EventSourcingDB answers with this error, as a line of the stream, and then ends the stream with its end item:

{
  "type": "error",
  "data": {
    "code": "https://docs.eventsourcingdb.io/errors/event-hash-malformed",
    "description": "event hash is malformed: expected 64 lowercase hexadecimal digits, prefixed with 'esdb:hash:v2:' for a hash of version 2",
    "details": {
      "value": "esdb:hash:v2:5ED0A363267D554F75EE284F444FCAAC46C1956D5BC24A2AFF21AB120C028702"
    }
  }
}