jackwener/OpenCLI · error · EmptyResultError

No purchased courses found — login session may have expired…

Error message

No purchased courses found — login session may have expired or the "内容" tab has no items

What it means

The study.xiaoe-tech.com page evaluated fine but returned no course rows. The library treats an empty result as EmptyResultError for xiaoe/courses, since purchased courses should exist for an authenticated user — the most likely cause is an expired login session or the '内容' (Content) tab genuinely having no items.

Solutions

  1. Log back in to xiaoe and retry the command
  2. Confirm in a browser that the account actually has items under the '内容' tab
  3. Retry once — the list may still have been loading
  4. Update the selectors/flow in buildCoursesScript if the site layout changed
Defensive patterns

Strategy: fallback

Validate before calling

null

Type guard

null

Try / catch

try {
  const courses = await getXiaoeCourses();
} catch (e) {
  if (e.name === 'EmptyResultError' && /No purchased courses found/.test(e.message)) {
    await refreshXiaoeSession();
    const retry = await getXiaoeCourses();
    if (!retry.length) throw new Error('account genuinely has no items under 内容');
    return retry;
  }
  throw e;
}

Prevention

When it happens

Trigger: page.evaluate(buildCoursesScript()) returns [] or a non-array: the '内容' tab is empty, the evaluator ran before the course list rendered, or the user is logged out and the DOM is an auth shell.

Common situations: Expired session cookie producing an empty-shell page; a brand-new account with no purchased content; slow lazy-loading of the course list past the settle window; site redesign renaming the '内容' tab.

Related errors


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

Appendix: source

Thrown at clis/xiaoe/courses.js:105

  }
  return results;
})()`;
}

async function getXiaoeCourses(page) {
    let rows;
    try {
        await page.goto('https://study.xiaoe-tech.com/', { waitUntil: 'load', settleMs: 8000 });
        rows = await page.evaluate(buildCoursesScript());
    } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        throw new CommandExecutionError(
            `Failed to list xiaoe courses: ${message}`,
            'page may not have rendered or auth may be required',
        );
    }
    if (!Array.isArray(rows) || rows.length === 0) {
        throw new EmptyResultError(
            'xiaoe/courses',
            'No purchased courses found — login session may have expired or the "内容" tab has no items',
        );
    }
    return rows;
}

export const coursesCommand = cli({
    site: 'xiaoe',
    name: 'courses',
    access: 'read',
    description: '列出已购小鹅通课程(含 URL 和店铺名)',
    domain: 'study.xiaoe-tech.com',
    strategy: Strategy.COOKIE,
    browser: true,
    columns: ['title', 'shop', 'url'],
    func: getXiaoeCourses,
});

View on GitHub (pinned to 49907e53dc)