jackwener/OpenCLI · warning · EmptyResultError

No catalog rows extracted — the URL may not be a course page

Error message

No catalog rows extracted — the URL may not be a course page or the login session has expired

What it means

Navigation succeeded but the catalog extraction returned either a non-array or an empty array, so getXiaoeCatalog throws EmptyResultError for 'xiaoe/catalog'. The library distinguishes this from a hard failure: the page loaded, but no product rows could be extracted.

Source

Thrown at clis/xiaoe/catalog.js:202

  return result;
})()`;
}

async function getXiaoeCatalog(page, args) {
    const url = requireXiaoePageUrl(args.url, 'catalog');
    let rows;
    try {
        await page.goto(url, { waitUntil: 'load', settleMs: 8000 });
        rows = await page.evaluate(buildCatalogScript());
    } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        throw new CommandExecutionError(
            `Failed to read xiaoe catalog: ${message}`,
            'page may not have rendered or auth may be required',
        );
    }
    if (!Array.isArray(rows) || rows.length === 0) {
        throw new EmptyResultError(
            'xiaoe/catalog',
            'No catalog rows extracted — the URL may not be a course page or the login session has expired',
        );
    }
    return rows;
}

export const catalogCommand = cli({
    site: 'xiaoe',
    name: 'catalog',
    access: 'read',
    description: '小鹅通课程目录(支持普通课程、专栏、大专栏)',
    domain: 'h5.xet.citv.cn',
    strategy: Strategy.COOKIE,
    browser: true,
    args: [
        { name: 'url', required: true, positional: true, help: '课程页面 URL' },
    ],

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the URL is a real xiaoe course catalog page (h5.xet.citv.cn/p/course/... style).
  2. Re-login via the xiaoe auth flow and retry — expired sessions often yield empty lists.
  3. Open the URL in a browser with the same session and confirm items are visible.
  4. Update buildCatalogScript() selectors if the catalog markup changed.

Example fix

// before
await getXiaoeCatalog(page, 'https://appxxxx.h5.xet.citv.cn/');
// after
await getXiaoeCatalog(page, 'https://appxxxx.h5.xet.citv.cn/p/t_pc/goods_pc_list/pd_id=xxxx'); // actual catalog page URL
Defensive patterns

Strategy: validation

Validate before calling

const u = new URL(url);
if (!u.hostname.endsWith('h5.xet.citv.cn') || !u.pathname.startsWith('/p/')) {
  throw new Error('not a xiaoe catalog page URL');
}

Type guard

function isCatalogUrl(u) {
  try { const p = new URL(u); return p.protocol === 'https:' && p.hostname.endsWith('.h5.xet.citv.cn') && /\/p\//.test(p.pathname); } catch { return false; }
}

Try / catch

try {
  rows = await getXiaoeCatalog(page, url);
} catch (e) {
  if (e instanceof EmptyResultError) {
    await runXiaoeLogin(page); // stale session often yields empty list
    rows = await getXiaoeCatalog(page, url);
  } else throw e;
}

Prevention

When it happens

Trigger: buildCatalogScript() evaluated on the loaded page returns [] or null/undefined — the URL is not actually a course/catalog page, or the page rendered in a logged-out/anti-bot state that hides the item list.

Common situations: Passing a storefront home or preview URL instead of a course catalog page; login session expired so the list renders empty; Xiaoe markup changed and the extraction selectors no longer match; region/permission gating hiding items from the account.

Related errors


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