jackwener/OpenCLI · error · CommandExecutionError

Failed to navigate to facebook notifications: ${message}

Error message

Failed to navigate to facebook notifications: ${message}

What it means

CommandExecutionError wrapping a navigation failure when page.goto(`${FB_HOST}/notifications`) throws. The original error message is interpolated into the message and a secondary hint ('facebook.com may be unreachable') is attached, so the root cause (DNS, TLS, timeout, crash) is preserved in text.

Source

Thrown at clis/facebook/notifications.js:280

  return extractNotificationRowsFromDoc(document, ${JSON.stringify(limit)}, {
    stripMark: stripMarkAsReadPrefix,
    stripChrome: stripAnchorChrome,
    parseQuery: parseNotifQuery,
    fbHost: FB_HOST,
    markPrefixes: MARK_AS_READ_PREFIXES,
    unreadBadges: UNREAD_BADGE_LABELS,
  });
})()
`;
}

async function getFacebookNotifications(page, args) {
    const limit = normalizeNotificationsLimit(args.limit);
    try {
        await page.goto(`${FB_HOST}/notifications`, { waitUntil: 'load', settleMs: 3000 });
    } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        throw new CommandExecutionError(
            `Failed to navigate to facebook notifications: ${message}`,
            'facebook.com may be unreachable',
        );
    }
    let rows;
    try {
        rows = await page.evaluate(buildNotificationsScript(limit));
    } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        if (/AUTH_REQUIRED/i.test(message)) {
            throw new AuthRequiredError(
                'facebook.com',
                'Open Chrome and log in to Facebook before retrying',
            );
        }
        throw new CommandExecutionError(
            `Failed to read facebook notifications: ${message}`,
            'facebook.com page may not have rendered or markup may have changed',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity and DNS resolution for facebook.com (ping/curl it)
  2. If behind a proxy/firewall, allow facebook.com or configure proxy env/flags for the browser
  3. Increase navigation timeout/wait tolerance if the connection is slow, then retry
  4. Look at the interpolated inner message in the error text for the precise goto failure and address it
Defensive patterns

Strategy: retry

Validate before calling

const reachable = await fetch('https://www.facebook.com', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!reachable) throw new Error('facebook.com unreachable; check network/proxy');

Try / catch

try {
  const rows = await getFacebookNotifications(page, args);
} catch (e) {
  if (/Failed to navigate to facebook notifications/.test(e.message)) {
    await waitFor(2000); await retryOnce(); // check the inner message for root cause
  } else throw e;
}

Prevention

When it happens

Trigger: page.goto throwing because facebook.com is unreachable: DNS failure, network offline, TLS/proxy issues, navigation timeout (settleMs 3000 exceeded), or the page/browser closing mid-navigation.

Common situations: Corporate proxy or firewall blocking facebook.com; no internet/DNS outage; very slow connection exceeding navigation waits; browser crashed before goto.

Related errors


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