jackwener/OpenCLI · warning · EmptyResultError
xiaoyuzhou history
Error message
xiaoyuzhou history
What it means
EmptyResultError for the 'xiaoyuzhou history' command: after pagination completed, zero history rows were collected. The library treats an empty history as an error rather than returning an empty list, so callers can distinguish 'no data' from a successful fetch.
Source
Thrown at clis/xiaoyuzhou/history.js:227
if (!fetchAll && rows.length >= limit) break;
if (page.next === null) {
exhausted = true;
break;
}
if (page.next === loadMoreKey || seenCursors.has(page.next)) {
throw new CommandExecutionError('Xiaoyuzhou history pagination repeated the same cursor');
}
if (pageNumber === maxPages) {
throw new CommandExecutionError(
`Xiaoyuzhou history stopped at the --max-pages safety limit (${maxPages}) before reaching the end`,
);
}
seenCursors.add(page.next);
loadMoreKey = page.next;
}
if (rows.length === 0) {
throw new EmptyResultError('xiaoyuzhou history', 'The logged-in account has no playback history');
}
if (fetchAll && !exhausted) {
throw new CommandExecutionError('Xiaoyuzhou history archive did not reach the end of pagination');
}
return rows;
}
cli({
site: 'xiaoyuzhou',
name: 'history',
access: 'read',
description: 'List playback history for the logged-in Xiaoyuzhou account',
domain: 'api.xiaoyuzhoufm.com',
strategy: Strategy.LOCAL,
browser: false,
args: [
{ name: 'limit', type: 'int', default: DEFAULT_LIMIT, help: `Maximum rows to return (default ${DEFAULT_LIMIT}, max ${MAX_LIMIT}). Ignored with --all.` },
{ name: 'all', type: 'bool', default: false, help: 'Fetch every history page until the API cursor is exhausted.' },View on GitHub (pinned to 49907e53dc)
Solutions
- Verify with a raw authenticated request that the history endpoint really returns no entries.
- Check the account in the app/website to confirm history exists; if it does, inspect parsing against the current response shape.
- Handle EmptyResultError explicitly in your code when an empty history is an acceptable outcome.
- Re-authenticate if the credentials belong to an unexpected (new) account.
Example fix
// before
const rows = await fetchHistory({ limit: 50 });
console.log(rows);
// after
let rows;
try { rows = await fetchHistory({ limit: 50 }); }
catch (e) {
if (e instanceof EmptyResultError) rows = [];
else throw e;
}
console.log(rows); Defensive patterns
Strategy: try-catch
Try / catch
try {
const rows = await fetchHistory(args);
} catch (e) {
if (e instanceof EmptyResultError) {
return []; // empty history is acceptable here
}
throw e;
} Prevention
- Catch EmptyResultError explicitly where empty history is expected (new accounts).
- Verify the account has history via the website before debugging parsing.
- Keep parsers updated against the current API response shape.
When it happens
Trigger: The logged-in account genuinely has no playback history; the history endpoint returns pages with zero entries; authentication succeeds but the account is new/reset; an API change moves entries to a different response field so parsing yields nothing.
Common situations: Freshly registered or wiped accounts; region/permission differences hiding history; API response shape changes silently emptying parsed entries; automated tests against empty accounts.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No Suno clips found in your library.
- No following entries returned + suffix
- NO_DATA
- Bilibili view API did not return pages[] for --page selectio
- 分P 序号超出范围:p=${pageNum}(该视频共 ${total} 集)
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/aab82185d962fa4b.
Report an issue: GitHub.