jackwener/OpenCLI · warning · EmptyResultError
Chess.com has games archives for ${username} but no games in
Error message
Chess.com has games archives for ${username} but no games in the most recent ${MAX_ARCHIVE_FETCHES} months What it means
The command walks at most MAX_ARCHIVE_FETCHES (6) most recent monthly archives; if archives exist but no games were collected after scanning those months, it throws EmptyResultError. This prevents silently returning zero rows when the player simply hasn't played recently.
Source
Thrown at clis/chess/games.js:61
throw new EmptyResultError(`Chess.com has no game archives for ${username}`);
}
const rows = [];
for (let i = 0; i < archives.length && i < MAX_ARCHIVE_FETCHES && rows.length < limit; i++) {
if (typeof archives[i] !== 'string' || !archives[i].startsWith('https://api.chess.com/pub/player/')) {
throw new CommandExecutionError('Chess.com archives payload contains an unexpected archive URL');
}
const monthly = await chessApi(archives[i]);
if (!Array.isArray(monthly.games)) {
throw new CommandExecutionError('Chess.com monthly archive payload is missing games array');
}
const games = monthly.games.slice().reverse();
for (const g of games) {
rows.push(mapGameRow(g, username));
if (rows.length >= limit) break;
}
}
if (rows.length === 0) {
throw new EmptyResultError(`Chess.com has games archives for ${username} but no games in the most recent ${MAX_ARCHIVE_FETCHES} months`);
}
return rows.slice(0, limit);
},
});
export const __test__ = { parseLimit };
View on GitHub (pinned to 49907e53dc)
Solutions
- If you need older games, fetch archive months beyond the 6-month window directly from https://api.chess.com/pub/player/{u}/games/{yyyy}/{mm}
- Confirm the player has actually played recently on chess.com
- Catch EmptyResultError and treat as 'no recent games' rather than an error
Example fix
// before
await gamesCommand(username, { limit: 10 }); // throws when player inactive 7+ months
// after
try { await gamesCommand(username, { limit: 10 }); }
catch (e) {
if (e.name === 'EmptyResultError') return []; // player has no recent games
throw e;
} Defensive patterns
Strategy: fallback
Validate before calling
// detect likely dormancy before the call by checking player's last online date
const player = await fetch(`https://api.chess.com/pub/player/${encodeURIComponent(username)}`).then(r => r.json());
// if player.last_online is older than ~6 months, expect no recent games Try / catch
try {
const rows = await gamesCmd(username, { limit });
} catch (e) {
if (e.name === 'EmptyResultError' && /no games in the most recent/.test(e.message)) return fetchOlderGamesManually(username) ?? [];
throw e;
} Prevention
- Check player.last_online before expecting recent games
- For players inactive >6 months, fetch older monthly archives directly instead of relying on the 6-month window
- Distinguish the two EmptyResultError messages (no archives at all vs no recent games) in your handling code
When it happens
Trigger: A player has archives (older months) but zero games in their 6 most recent archive months — e.g. they stopped playing 7+ months ago, or recent months' archives contain only empty game lists.
Common situations: Inactive/dormant accounts; players who only played a few games long ago; requesting games for someone who recently created a new account with games only in old imported archives.
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
- Chess.com has no game archives for ${username}
- Chess.com returned no stats for ${username}
- No trains found from ${fromStation.name} to ${toStation.name
- NO_DATA
- No Wayback snapshots for "${target}".
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/54239ac901ab6f1c.
Report an issue: GitHub.