jackwener/OpenCLI · warning · EmptyResultError

Chess.com has no game archives for ${username}

Error message

Chess.com has no game archives for ${username}

What it means

If the archives list exists but is empty, the command throws EmptyResultError: Chess.com has no archived games at all for this username. Unlike the other errors this is an expected 'no data' outcome, not a failure.

Source

Thrown at clis/chess/games.js:43

    description: 'Chess.com recent games for a player, newest first',
    domain: 'api.chess.com',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'username', type: 'string', required: true, positional: true, help: 'Chess.com username' },
        { name: 'limit', type: 'int', default: 10, help: `Number of recent games (1-${MAX_LIMIT})` },
    ],
    columns: ['date', 'time_class', 'rated', 'my_color', 'my_rating', 'my_result', 'opponent', 'opponent_rating', 'accuracy_white', 'accuracy_black', 'eco', 'opening_name', 'url'],
    func: async (kwargs) => {
        const username = validateUsername(kwargs.username);
        const limit = parseLimit(kwargs.limit);
        const archivesList = await chessApi(`/player/${encodeURIComponent(username)}/games/archives`);
        if (!Array.isArray(archivesList.archives)) {
            throw new CommandExecutionError('Chess.com archives payload is missing archives array');
        }
        const archives = archivesList.archives.slice().reverse();
        if (archives.length === 0) {
            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`);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the correct username (Chess.com usernames are case-insensitive but exact in spelling)
  2. If you expected games, check the player profile on chess.com to confirm they have played
  3. Catch EmptyResultError and treat it as an empty dataset in your tooling

Example fix

// before
await gamesCommand(username); // crashes on empty
// after
try { await gamesCommand(username); }
catch (e) { if (e.name === 'EmptyResultError') return []; throw e; }
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const rows = await gamesCmd(username);
} catch (e) {
  if (e.name === 'EmptyResultError' && /no game archives/.test(e.message)) return [];
  throw e;
}

Prevention

When it happens

Trigger: The /player/{username}/games/archives call succeeds and returns { archives: [] } — the player account exists but has never played any games recorded in archives.

Common situations: Newly registered accounts with zero games; accounts that only play in modes not archived; checking bot/admin 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


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