jackwener/OpenCLI · error · CommandExecutionError

Could not resolve Sales Navigator auth token for recipient

Error message

Could not resolve Sales Navigator auth token for recipient

What it means

When the --recipient was only partially resolvable (e.g. a /in/ URL with empty authType/authToken), resolveRecipient opens the Sales Navigator lead page and probes the DOM for the full profile triple. If the probe can't recover the auth token, it throws CommandExecutionError with the observed URL and a 500-char body snippet as detail.

Source

Thrown at clis/linkedin/salesnav-message.js:226

      profileId: decodeURIComponent(urlMatch[1]),
      authType: decodeURIComponent(urlMatch[2]),
      authToken: decodeURIComponent(urlMatch[3]),
      entityUrn: `urn:li:fs_salesProfile:(${decodeURIComponent(urlMatch[1])},${decodeURIComponent(urlMatch[2])},${decodeURIComponent(urlMatch[3])})`,
    };
  }
  for (const resource of probe?.resourceUrns || []) {
    const resourceMatch = String(resource).match(/profileId:([^,)]+),authType:([^,)]+),authToken:([^,)]+)\)/);
    if (resourceMatch && resourceMatch[1] === parsed.profileId) {
      return {
        profileId: resourceMatch[1],
        authType: resourceMatch[2],
        authToken: resourceMatch[3],
        entityUrn: `urn:li:fs_salesProfile:(${resourceMatch[1]},${resourceMatch[2]},${resourceMatch[3]})`,
      };
    }
  }
  void csrf;
  throw new CommandExecutionError('Could not resolve Sales Navigator auth token for recipient', `Observed URL: ${probe?.href || 'url_not_available'}\nBody: ${normalizeWhitespace(probe?.text || '').slice(0, 500)}`);
}

function profileSummary(json) {
  const data = json?.data || json || {};
  const pos = data.defaultPosition || (Array.isArray(data.positions) ? data.positions.find((p) => p.current) || data.positions[0] : {}) || {};
  return {
    recipient: normalizeWhitespace(data.fullName || [data.firstName, data.lastName].filter(Boolean).join(' ')),
    title: normalizeWhitespace(pos.title || data.headline || ''),
    company: normalizeWhitespace(pos.companyName || pos.company?.name || ''),
    degree: normalizeWhitespace(data.degree || ''),
    inmail_restriction: normalizeWhitespace(data.inmailRestriction || ''),
    open_link: Boolean(data.memberBadges?.openLink),
  };
}

function requireProfileSummary(json) {
  const summary = profileSummary(json);
  if (!summary.recipient) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Review the detail: Observed URL + body snippet shows where the flow ended
  2. Supply a fully-qualified urn:li:fs_salesProfile:(...) or Sales Nav lead URL so no resolution is needed
  3. Confirm the recipient exists in Sales Navigator (search for them first)
  4. Increase wait time or retry if the page was still loading

Example fix

// before
--recipient "https://www.linkedin.com/in/jane-doe/"
// after
--recipient "urn:li:fs_salesProfile:(ACoAAAabc,ACoAAUTH,token123)"
Defensive patterns

Strategy: try-catch

Validate before calling

// Prefer fully-resolved inputs so no DOM resolution is needed
const fullyResolved = /^urn:li:fs_salesProfile:\([^,()]+,[^,()]+,[^,()]+\)$/.test(recipient.trim());
if (!fullyResolved) console.warn('recipient will be resolved via Sales Nav page probe; ensure a Sales Nav seat & viewable profile');

Type guard

const isResolvedUrn = (v) => {
  const m = /^urn:li:fs_salesProfile:\(([^,()]+),([^,()]+),([^,()]+)\)$/.test(v || '');
  return m && !/undefined|null|not_available/i.test(v);
};

Try / catch

try {
  recipient = await resolveRecipient(page, parsed, csrf);
} catch (err) {
  if (/Could not resolve Sales Navigator auth token/.test(err.message)) {
    console.error(err.detail); // shows Observed URL + body snippet
    // ask user for a fully-qualified urn or verify Sales Nav access
  } else throw err;
}

Prevention

When it happens

Trigger: The lead page redirected (profile not viewable, no Sales Nav seat, logged-out redirect), the DOM deco object never rendered within the 6s wait, or the probe text didn't match the expected resource pattern.

Common situations: Recipient lacks a Sales Navigator profile (only a plain LinkedIn account); viewing limit reached on Sales Nav; LinkedIn layout change altering the embedded profile deco; page still loading when probed.

Related errors


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