jackwener/OpenCLI · error · CommandExecutionError

LinkedIn messengerMessages payload contains a message withou

Error message

LinkedIn messengerMessages payload contains a message without a valid timestamp.

What it means

Each Message entity must have a positive finite deliveredAt epoch value; the parser throws when Number(entity.deliveredAt) is NaN, negative, or zero. Timestamps drive message ordering, so a missing or invalid one makes the conversation snapshot unreliable.

Source

Thrown at clis/linkedin/thread-snapshot.js:273

  );
  const recipientNames = Array.from(new Set(participants
    .filter((participant) => participant.hostIdentityUrn !== ownerUrn)
    .map(participantName)
    .filter(Boolean)));
  if (recipientNames.length === 0) {
    throw new CommandExecutionError('LinkedIn messengerMessages payload is missing the counterparty participant.');
  }

  const byMessageId = new Map();
  for (const entity of entities.values()) {
    if (entity.$type !== 'com.linkedin.messenger.Message') continue;
    const messageId = normalizeWhitespace(entity.entityUrn || entity.backendUrn || entity.originToken);
    if (!messageId) {
      throw new CommandExecutionError('LinkedIn messengerMessages payload contains a message without an id.');
    }
    const deliveredAt = Number(entity.deliveredAt);
    if (!Number.isFinite(deliveredAt) || deliveredAt <= 0) {
      throw new CommandExecutionError('LinkedIn messengerMessages payload contains a message without a valid timestamp.');
    }
    const senderUrn = normalizeWhitespace(entity['*sender'] || entity['*actor']);
    const sender = senderUrn ? entities.get(senderUrn) : null;
    const speaker = participantName(sender);
    if (!speaker) {
      throw new CommandExecutionError('LinkedIn messengerMessages payload contains a message with an unresolved sender.');
    }
    byMessageId.set(messageId, {
      messageUrn: messageId,
      speaker,
      text: messageText(entity),
      deliveredAt,
    });
  }

  const messages = Array.from(byMessageId.values())
    .sort((left, right) => left.deliveredAt - right.deliveredAt || left.messageUrn.localeCompare(right.messageUrn))
    .map((message, index) => ({ index, ...message }));

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the snapshot after a short delay so freshly sent messages get timestamps
  2. Update the library to read the current timestamp field if LinkedIn renamed deliveredAt
  3. Inspect the entity: if deliveredAt is a string epoch, extend the parser to coerce strings
  4. Exclude or pre-filter malformed messages before calling the CLI if you control the capture pipeline

Example fix

// before
const deliveredAt = Number(entity.deliveredAt);
// after: tolerate string epochs and alternate fields
const deliveredAt = Number(entity.deliveredAt ?? entity.createdAt ?? Date.parse(entity.deliveredAtDateTime) || NaN);
Defensive patterns

Strategy: validation

Validate before calling

function hasValidTimestamp(entity) {
  const t = Number(entity.deliveredAt);
  return Number.isFinite(t) && t > 0;
}
if (!payload.included.filter(e => e?.$type === 'com.linkedin.messenger.Message').every(hasValidTimestamp)) {
  throw new Error('Message missing deliveredAt; delay capture after sends');
}

Type guard

const hasValidDeliveredAt = (e) => { const t = Number(e.deliveredAt); return Number.isFinite(t) && t > 0; };

Try / catch

try {
  const snap = await run('linkedin thread-snapshot', { 'thread-url': url });
} catch (err) {
  if (String(err.message).includes('without a valid timestamp')) {
    // retry after a short delay or pre-filter timestamp-less messages
  } else throw err;
}

Prevention

When it happens

Trigger: A Message entity has deliveredAt missing, null, a non-numeric string, or 0 — typically schema drift, placeholder entities, or a message captured before its timestamp was populated (e.g. just-sent message in a live capture).

Common situations: Snapshotting a thread immediately after sending a message; outdated parser after LinkedIn renamed/retyped deliveredAt (e.g. moved to nested createdAt); fixtures with string timestamps or missing fields.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/03d946e7fccbe5e2. Report an issue: GitHub.