ruvnet/ruflo · error · Error

message sequence must be a canonical unsigned decimal intege

Error message

message sequence must be a canonical unsigned decimal integer

What it means

Thrown when a message sequence value is not a canonical unsigned decimal integer. Defense: generate sequence numbers from a monotonic counter serialized as a plain decimal string without padding or signs.

Source

Thrown at v3/@claude-flow/codex/src/harness/in-memory-inbox-reference.ts:84

      throw new Error('message ID, issuer, and audience are required');
    }
    const identity = inMemoryInboxIdentityKey(message.issuer, message.messageId);
    const receivedAt = new Date(this.now()).toISOString();
    let suppliedDigest: string;
    try {
      suppliedDigest = harnessMessageContentDigest(message.content);
    } catch {
      this.quarantine(message, 'content-digest-mismatch', receivedAt);
      throw new Error('message content is not canonical JSON');
    }
    if (suppliedDigest !== message.contentDigest) {
      this.quarantine(message, 'content-digest-mismatch', receivedAt);
      throw new Error('message contentDigest does not match canonical content');
    }
    try {
      parseCanonicalUnsigned(message.sequence, 'message sequence');
    } catch {
      throw new Error('message sequence must be a canonical unsigned decimal integer');
    }
    if (message.expiresAt !== undefined && !Number.isFinite(Date.parse(message.expiresAt))) {
      throw new Error('message expiresAt must be an ISO timestamp');
    }

    const envelopeDigest = sha256(canonicalJson(message));
    const prior = this.byIdentity.get(identity);
    if (prior) {
      if (prior.issuer !== message.issuer || prior.messageId !== message.messageId) {
        throw new Error('inbox identity hash collision');
      }
      if (prior.envelopeDigest !== envelopeDigest) {
        this.quarantine(message, 'message-id-content-conflict', receivedAt);
        throw new Error('message ID was reused with different content');
      }
      return { messageId: message.messageId, acceptedAt: prior.record.receivedAt, duplicate: true };
    }

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Pass the sequence as a base-10 unsigned integer string with no leading zeros, signs, or whitespace.
  2. Monotonically increment the sequence per inbox stream rather than reusing or formatting it ad hoc.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/@claude-flow/codex/src/harness/in-memory-inbox-reference.ts:84 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/3dc726e910272e75. Report an issue: GitHub.