jackwener/OpenCLI · warning · EmptyResultError
lichess top: Lichess returned no leaderboard rows for perf "
Error message
lichess top: Lichess returned no leaderboard rows for perf "${perf}". What it means
lichess top fetches the leaderboard for a perf type and requires a non-empty body.users array. If Lichess responds with no rows (users missing or empty), it throws EmptyResultError naming the perf. This indicates the leaderboard is unavailable/empty for that perf type rather than a transport failure.
Source
Thrown at clis/lichess/top.js:29
name: 'top',
access: 'read',
description: 'Top-N Lichess leaderboard for a perf type (bullet/blitz/rapid/classical/...)',
domain: 'lichess.org',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'perf', positional: true, required: true, help: 'Perf type (bullet, blitz, rapid, classical, ultraBullet, chess960, ...)' },
{ name: 'limit', type: 'int', default: 10, help: 'Top-N rows (1-200)' },
],
columns: ['rank', 'username', 'id', 'title', 'rating', 'progress', 'patron', 'url'],
func: async (args) => {
const perf = requirePerf(args.perf);
const limit = requireBoundedInt(args.limit, 10, 200);
const url = `${LICHESS_BASE}/api/player/top/${limit}/${encodeURIComponent(perf)}`;
const body = await lichessFetch(url, 'lichess top');
const list = Array.isArray(body?.users) ? body.users : [];
if (!list.length) {
throw new EmptyResultError('lichess top', `Lichess returned no leaderboard rows for perf "${perf}".`);
}
return list.slice(0, limit).map((u, i) => {
const username = typeof u?.username === 'string' ? u.username : '';
const perfBlock = u?.perfs && typeof u.perfs === 'object' ? u.perfs[perf] ?? {} : {};
return {
rank: i + 1,
username,
id: typeof u?.id === 'string' ? u.id : null,
title: typeof u?.title === 'string' ? u.title : null,
rating: typeof perfBlock.rating === 'number' ? perfBlock.rating : null,
progress: typeof perfBlock.progress === 'number' ? perfBlock.progress : null,
patron: u?.patron === true,
url: username ? `${LICHESS_BASE}/@/${encodeURIComponent(username)}/perf/${encodeURIComponent(perf)}` : '',
};
});
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Use a popular perf type (bullet, blitz, rapid, classical) to confirm the API works
- Verify the perf name against Lichess /api/player/top/<limit>/<perf> in a browser
- Reduce or adjust the limit if a boundary value yields an empty page
- Retry later if Lichess is having API issues
Example fix
// before
await lichessTop('puzzle-race');
// after
await lichessTop('blitz'); // valid perf with populated leaderboard Defensive patterns
Strategy: retry
Validate before calling
const VALID_PERFS = ['bullet','blitz','rapid','classical','ultraBullet','crazyhouse','antichess','atomic','horde','kingOfTheHill','racingKings','threeCheck'];
if (!VALID_PERFS.includes(perf)) throw new Error(`unknown perf: ${perf}`); Type guard
const hasLeaderboard = (body) => Array.isArray(body?.users) && body.users.length > 0;
Try / catch
try {
await lichessTop(perf);
} catch (e) {
if (e.name === 'EmptyResultError') {
// fall back to a popular perf or retry after delay
} else throw e;
} Prevention
- Use mainstream perfs (bullet/blitz/rapid/classical) for reliable data
- Verify perf names against Lichess API docs
- Retry once on empty leaderboards (transient API issues)
- Handle sparse variant leaderboards gracefully
When it happens
Trigger: Requesting a perf with no rated players (rare/variant perfs like 'threeCheck' or invalid-but-accepted perfs), a limit beyond available players, or Lichess returning an empty users object for that limit/perf combination.
Common situations: Niche variants with very few ranked players; typo'd perf name slipping past validation; Lichess API hiccup returning {} without users; asking for top 200 when only a handful exist (only if users array is empty, not short).
Related errors
- lichess user: Lichess user "${username}" returned empty payl
- lichess user: Lichess user "${username}" is closed/disabled.
- devto/${id}
- NO_DATA
- eastmoney convertible
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/8d5f335f381592cc.
Report an issue: GitHub.