jackwener/OpenCLI · error · EmptyResultError

No rows returned from page evaluator (page structure may hav

Error message

No rows returned from page evaluator (page structure may have changed)

What it means

After the page evaluates successfully, the library expects an array of rows. If the in-page evaluator returns an empty array or something that is not an array, this EmptyResultError is thrown for command xiaoe/content, indicating the page's structure may have changed so the extraction selectors no longer match.

Source

Thrown at clis/xiaoe/content.js:143

})()
`;
}

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;
}

export const contentCommand = cli({
    site: 'xiaoe',
    name: 'content',
    access: 'read',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry once in case the page was mid-render
  2. Verify manually in a browser that the URL still shows article content
  3. Update CONTENT_SELECTORS in clis/xiaoe/content.js to match the new DOM structure
  4. Check for a login/bot wall in the rendered page and refresh auth
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  const rows = await getXiaoeContent(url);
} catch (e) {
  if (e.name === 'EmptyResultError' && /page structure may have changed/.test(e.message)) {
    await sleep(3000);
    return getXiaoeContent(url); // one retry; if it persists, DOM changed
  }
  throw e;
}

Prevention

When it happens

Trigger: page.evaluate(buildContentScript()) resolves to [] or a non-array (undefined/null), typically because none of CONTENT_SELECTORS matched and the fallbacks produced nothing the script deemed valid.

Common situations: Xiaoe shipped a front-end redesign changing .rich-text-wrap and friends; page rendered a bot-check or error state instead of the article; JS-rendered content not ready when the evaluator ran.

Related errors


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