jackwener/OpenCLI · error · CommandExecutionError

Failed to extract xiaoe content: ${message}

Error message

Failed to extract xiaoe content: ${message}

What it means

getXiaoeContent navigates a real browser to the xiaoe page and runs an in-page evaluator to extract the article rows. If either page.goto or page.evaluate throws (render failure, navigation error, crashed tab), the error is wrapped in a CommandExecutionError with a hint that the page may not have rendered or auth may be required.

Source

Thrown at clis/xiaoe/content.js:137

  return [{
    title,
    content,
    content_length: content.length,
    image_count: imageCount,
  }];
})()
`;
}

async function getXiaoeContent(page, args) {
    const url = requireXiaoePageUrl(args.url, 'content');
    let rows;
    try {
        await page.goto(url, { waitUntil: 'load', settleMs: 6000 });
        rows = await page.evaluate(buildContentScript());
    } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        throw new CommandExecutionError(
            `Failed to extract xiaoe content: ${message}`,
            'page may not have rendered or auth may be required',
        );
    }
    if (!Array.isArray(rows) || rows.length === 0) {
        throw new EmptyResultError(
            'xiaoe/content',
            'No rows returned from page evaluator (page structure may have changed)',
        );
    }
    const row = rows[0];
    if (!row || typeof row.content !== 'string' || row.content.length === 0) {
        throw new EmptyResultError(
            'xiaoe/content',
            'No article content extracted — login session may have expired or the page renders an empty shell',
        );
    }
    return rows;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity/proxy and retry the command
  2. Re-authenticate the xiaoe session (refresh cookies) and retry
  3. Retry once — transient render/navigation flakes are common
  4. Check the inner error message (embedded in this message) for the root cause, e.g. timeout vs JS exception
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check reachability before invoking
const res = await fetch('https://h5.xet.citv.cn/', { method: 'HEAD' }).catch(() => null);
if (!res || !res.ok) throw new Error('h5.xet.citv.cn unreachable — fix network/proxy first');

Type guard

null

Try / catch

try {
  const rows = await getXiaoeContent(url);
} catch (e) {
  if (e.name === 'CommandExecutionError' && e.message.startsWith('Failed to extract xiaoe content')) {
    console.error('Extraction failed:', e.message, '— hint:', e.hint);
    // inspect inner cause, check auth, retry once
  } else throw e;
}

Prevention

When it happens

Trigger: page.goto fails (network error, DNS failure, TLS problem, navigation timeout), or page.evaluate throws inside buildContentScript (DOM not as expected, script runtime error, page navigation during evaluate).

Common situations: Offline machine or corporate proxy blocking h5.xet.citv.cn; expired cookies causing a redirect loop; page heavy JS SPA that times out before 'load'; site DOM changed breaking the content script.

Related errors


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