{"record":{"id":"8cfd4372aff92c24","repo":"jackwener/OpenCLI","slug":"chess-com-has-no-game-archives-for-username","errorCode":null,"errorMessage":"Chess.com has no game archives for ${username}","messagePattern":"Chess\\.com has no game archives for (.+?)","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/chess/games.js","lineNumber":43,"sourceCode":"    description: 'Chess.com recent games for a player, newest first',\n    domain: 'api.chess.com',\n    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { name: 'username', type: 'string', required: true, positional: true, help: 'Chess.com username' },\n        { name: 'limit', type: 'int', default: 10, help: `Number of recent games (1-${MAX_LIMIT})` },\n    ],\n    columns: ['date', 'time_class', 'rated', 'my_color', 'my_rating', 'my_result', 'opponent', 'opponent_rating', 'accuracy_white', 'accuracy_black', 'eco', 'opening_name', 'url'],\n    func: async (kwargs) => {\n        const username = validateUsername(kwargs.username);\n        const limit = parseLimit(kwargs.limit);\n        const archivesList = await chessApi(`/player/${encodeURIComponent(username)}/games/archives`);\n        if (!Array.isArray(archivesList.archives)) {\n            throw new CommandExecutionError('Chess.com archives payload is missing archives array');\n        }\n        const archives = archivesList.archives.slice().reverse();\n        if (archives.length === 0) {\n            throw new EmptyResultError(`Chess.com has no game archives for ${username}`);\n        }\n        const rows = [];\n        for (let i = 0; i < archives.length && i < MAX_ARCHIVE_FETCHES && rows.length < limit; i++) {\n            if (typeof archives[i] !== 'string' || !archives[i].startsWith('https://api.chess.com/pub/player/')) {\n                throw new CommandExecutionError('Chess.com archives payload contains an unexpected archive URL');\n            }\n            const monthly = await chessApi(archives[i]);\n            if (!Array.isArray(monthly.games)) {\n                throw new CommandExecutionError('Chess.com monthly archive payload is missing games array');\n            }\n            const games = monthly.games.slice().reverse();\n            for (const g of games) {\n                rows.push(mapGameRow(g, username));\n                if (rows.length >= limit) break;\n            }\n        }\n        if (rows.length === 0) {\n            throw new EmptyResultError(`Chess.com has games archives for ${username} but no games in the most recent ${MAX_ARCHIVE_FETCHES} months`);","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chess/games.js#L25-L61","documentation":"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.","triggerScenarios":"The /player/{username}/games/archives call succeeds and returns { archives: [] } — the player account exists but has never played any games recorded in archives.","commonSituations":"Newly registered accounts with zero games; accounts that only play in modes not archived; checking bot/admin accounts.","solutions":["Verify the correct username (Chess.com usernames are case-insensitive but exact in spelling)","If you expected games, check the player profile on chess.com to confirm they have played","Catch EmptyResultError and treat it as an empty dataset in your tooling"],"exampleFix":"// before\nawait gamesCommand(username); // crashes on empty\n// after\ntry { await gamesCommand(username); }\ncatch (e) { if (e.name === 'EmptyResultError') return []; throw e; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const rows = await gamesCmd(username);\n} catch (e) {\n  if (e.name === 'EmptyResultError' && /no game archives/.test(e.message)) return [];\n  throw e;\n}","preventionTips":["Treat EmptyResultError as an expected empty dataset, not a crash","Double-check spelling of usernames (new/typo'd accounts are the usual cause)","Handle zero-game accounts explicitly in dashboards/scripts"],"tags":["empty-result","no-data","chess-com"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}