Docs / EventSourcingDB / Errors / tracestate-malformed

tracestate-malformed

The tracestate of an event is not valid under W3C Trace Context.

  • Route: write-events
  • Description: one of these texts, which names the rule that the value breaks:
    • tracestate is malformed: expected at most 32 members, as W3C Trace Context defines, when it has more members
    • tracestate is malformed: expected each key at most once, as W3C Trace Context defines, when a key repeats
    • tracestate is malformed: expected a comma-separated list of key=value members as defined by W3C Trace Context, for any other mistake
  • Details: event, the place of the event in its list, counting from 0, and value, the tracestate as the request gave it.

Why It Happens#

A tracestate carries vendor-specific data of a distributed trace as a comma-separated list of key=value members, with at most 32 members and each key at most once, see Integrating OpenTelemetry. A key is made of lowercase letters, digits, _, -, *, and /, starting with a letter, or has the form tenant@system, and a value is 1 to 256 printable ASCII characters other than commas and equal signs, not ending in a space.

A typical cause is a member with another separator than the equal sign, such as rojo:00f067aa0ba902b7, or a key with uppercase letters.

How to Fix It#

Send the tracestate as W3C Trace Context writes it, which tracing libraries such as OpenTelemetry do, or leave it out. Sending the same request again fails the same way, since the error depends on the request alone.

Example#

For a write whose first event has the tracestate rojo:00f067aa0ba902b7, with a colon instead of an equal sign, 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/tracestate-malformed",
    "description": "tracestate is malformed: expected a comma-separated list of key=value members as defined by W3C Trace Context",
    "details": {
      "event": 0,
      "value": "rojo:00f067aa0ba902b7"
    }
  }
}