jackwener/OpenCLI · error · CommandExecutionError

LinkedIn did not issue a messengerMessages API request for t

Error message

LinkedIn did not issue a messengerMessages API request for this thread.

What it means

This error is thrown by validateThreadApiUrls when the browser-side discovery script found zero messengerMessages API requests in the page's performance resource entries. The CLI scrapes LinkedIn messaging threads by replaying the exact voyager GraphQL requests the web app made; without at least one captured URL there is nothing to fetch or parse. It signals that the thread page never issued (or the script failed to observe) a messengerMessages request.

Source

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

    || message?.subject
    || '',
  );
}

function ownerUrnFromApiUrls(apiUrls) {
  for (const url of apiUrls) {
    let decoded = url;
    try { decoded = decodeURIComponent(url); } catch {}
    const match = decoded.match(/conversationUrn:urn:li:msg_conversation:\((urn:li:fsd_profile:[^,)]+)/i);
    if (match) return match[1];
  }
  return '';
}

function validateThreadApiUrls(apiUrls, threadUrl) {
  const threadId = new URL(threadUrl).pathname.match(/^\/messaging\/thread\/([^/]+)\/?$/i)?.[1] || '';
  if (!Array.isArray(apiUrls) || apiUrls.length === 0) {
    throw new CommandExecutionError('LinkedIn did not issue a messengerMessages API request for this thread.');
  }
  for (const value of apiUrls) {
    let url;
    try {
      url = new URL(value);
    } catch {
      throw new CommandExecutionError('LinkedIn messengerMessages discovery returned an invalid URL.');
    }
    let decoded = value;
    try { decoded = decodeURIComponent(value); } catch {}
    if (url.protocol !== 'https:'
      || url.hostname !== LINKEDIN_DOMAIN
      || url.pathname !== '/voyager/api/voyagerMessagingGraphQL/graphql'
      || !/^messengerMessages\.[a-f0-9]+$/i.test(url.searchParams.get('queryId') || '')
      || !threadId
      || !decoded.includes(threadId)) {
      throw new CommandExecutionError('LinkedIn messengerMessages discovery returned an unsafe or mismatched URL.');
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the input URL is an exact https://www.linkedin.com/messaging/thread/<id>/ URL and that the browser actually navigated to it before running the command.
  2. Increase --max-scrolls so the discovery script scrolls longer and gives the lazy-loaded thread time to fire messengerMessages requests.
  3. Reload the thread page and rerun; manually open devtools Network and confirm messengerMessages requests appear when the thread loads.
  4. Check for LinkedIn UI/API changes (new endpoint path or queryId pattern) and update the discovery regexes in buildThreadApiDiscoveryScript.

Example fix

// before: running against the messaging inbox
await run(['linkedin', 'thread-snapshot', '--url', 'https://www.linkedin.com/messaging/']);
// after: exact thread URL
await run(['linkedin', 'thread-snapshot', '--url', 'https://www.linkedin.com/messaging/thread/2-MTM0NjU0/']);
Defensive patterns

Strategy: validation

Validate before calling

const m = threadUrl.match(/^\/messaging\/thread\/([^/]+)\/?$/i);
if (!m) throw new Error('Provide an exact https://www.linkedin.com/messaging/thread/<id>/ URL before running thread-snapshot.');

Type guard

function isThreadUrl(u) {
  try { return /^\/messaging\/thread\/[^/]+\/?$/i.test(new URL(u).pathname); }
  catch { return false; }
}

Try / catch

try {
  const snapshot = await cli.linkedin.threadSnapshot({ url: threadUrl });
} catch (err) {
  if (err.message.includes('did not issue a messengerMessages API request')) {
    // navigate to the thread, reload the page, retry with higher --max-scrolls
  } else throw err;
}

Prevention

When it happens

Trigger: performance.getEntriesByType('resource') contains no URL matching /voyager/api/voyagerMessagingGraphQL/graphql with queryId=messengerMessages.<hex>, or every match was skipped because it did not decode-include the threadId. validateThreadApiUrls then receives an empty/non-array apiUrls list.

Common situations: Developer navigated to a wrong or non-thread URL; the messaging list page was open but the thread never loaded; LinkedIn changed its API endpoints or queryId format; a hardened browser/extension cleared or restricted the performance buffer; the thread view was server-cached so no new request fired during the scroll window.

Related errors


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