jackwener/OpenCLI · error · CommandExecutionError

`Failed to navigate to facebook feed: ${err instanceof Error

Error message

`Failed to navigate to facebook feed: ${err instanceof Error ? err.message : err}`

What it means

getFacebookFeed wraps page.goto(FACEBOOK_HOME) in a try/catch and rethrows any navigation failure as a CommandExecutionError with a remediation hint. This means the browser extension could not load facebook.com within the settle window (4000ms). It is the library's way of converting raw navigation errors (DNS, timeouts, browser disconnected) into a consistent, actionable error type.

Source

Thrown at clis/facebook/feed.js:349

    if (rowCount >= limit) break;

    if (markerCount === prevMarkerCount && rowCount === prevRowCount) {
      stalledPasses += 1;
      if (stalledPasses >= 2) break;
    } else {
      stalledPasses = 0;
    }
    prevMarkerCount = markerCount;
    prevRowCount = rowCount;
  }
}

async function getFacebookFeed(page, kwargs) {
  const limit = requireLimit(kwargs.limit ?? 10);
  try {
    await page.goto(FACEBOOK_HOME, { settleMs: 4000 });
  } catch (err) {
    throw new CommandExecutionError(
      `Failed to navigate to facebook feed: ${err instanceof Error ? err.message : err}`,
      'Check that facebook.com is reachable and the browser extension is connected.',
    );
  }

  await loadFeedPosts(page, limit);

  let payload;
  try {
    payload = unwrapBrowserResult(await page.evaluate(buildFeedExtractScript(limit)));
  } catch (err) {
    throw new CommandExecutionError(
      `Failed to read facebook feed: ${err instanceof Error ? err.message : err}`,
      'Facebook may not have rendered or the feed markup may have changed.',
    );
  }

  if (!payload || typeof payload !== 'object' || !Array.isArray(payload.rows)) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify facebook.com loads in the connected browser and that general connectivity works (curl or open the URL).
  2. Confirm the browser extension/Chrome session is running and connected before invoking the feed command.
  3. Check proxy/VPN/DNS settings if in a restricted network; retry with a VPN if Facebook is blocked.
  4. Re-run the command; transient network blips during the 4s settle window cause this.

Example fix

// before
await page.goto(FACEBOOK_HOME, { settleMs: 4000 });
// after
try {
  await page.goto(FACEBOOK_HOME, { settleMs: 8000 });
} catch (err) {
  if (!(await browser.isConnected())) await startBrowserSession();
  await page.goto(FACEBOOK_HOME, { settleMs: 8000 });
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight
if (!navigator.online) throw new Error('offline');
const reachable = await fetch('https://www.facebook.com', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!reachable) throw new Error('facebook.com not reachable from this network');

Type guard

function isCommandExecutionError(e) { return e instanceof Error && 'hint' in e; }

Try / catch

try {
  const rows = await getFacebookFeed(page, { limit: 10 });
} catch (err) {
  if (/Failed to navigate to facebook feed/.test(err.message)) {
    await ensureBrowserConnected();
    // retry once
  } else throw err;
}

Prevention

When it happens

Trigger: page.goto(FACEBOOK_HOME) rejects: no network/DNS failure to facebook.com, browser session not connected (extension disconnected), page closed, navigation timeout, or ERR_NAME_NOT_RESOLVED / ERR_CONNECTION_REFUSED from Chromium.

Common situations: Running the CLI with no internet or behind a corporate proxy; the browser extension companion process is not running or has been killed; Facebook regional blocks/DNS issues; the headed Chrome instance was closed before the command ran.

Related errors


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