{"record":{"id":"bbe529005ddd2592","repo":"jackwener/OpenCLI","slug":"hltv-team-map-pool-parser-returned-an-unexpected-s","errorCode":null,"errorMessage":"hltv team-map-pool parser returned an unexpected shape","messagePattern":"hltv team-map-pool parser returned an unexpected shape","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/hltv/team-map-pool.js","lineNumber":91,"sourceCode":"        byMap.set(mapName, {\n          category: 'map',\n          key: mapName,\n          teamId: payload.teamId,\n          team,\n          record,\n          winRate,\n          totalRounds,\n          firstKillWinPct,\n          firstDeathWinPct,\n          pickPct,\n          banPct,\n          mapUrl: byMap.get(mapName)?.mapUrl ?? null,\n        });\n      }\n      return [...byMap.values()];\n    }, { base: BASE, teamId, slug });\n\n    if (!Array.isArray(rawRows)) throw new CommandExecutionError('hltv team-map-pool parser returned an unexpected shape');\n    if (rawRows.length === 0) throw new EmptyResultError('hltv team-map-pool', `No map-pool rows found for team ${teamId}/${slug}`);\n\n    const rows = rawRows.map((row) => {\n      const record = splitRecord(row.record);\n      const maps = record.wins === null ? null : (record.wins ?? 0) + (record.draws ?? 0) + (record.losses ?? 0);\n      return {\n        category: row.category,\n        key: row.key,\n        teamId: row.teamId,\n        team: row.team,\n        maps,\n        winMaps: record.wins,\n        lossMaps: record.losses,\n        winRatePct: parseNumber(row.winRate),\n        avgRoundDiff: null,\n        details: {\n          draws: record.draws,\n          totalRounds: parseNumber(row.totalRounds),","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/hltv/team-map-pool.js#L73-L109","documentation":"The team-map-pool command runs an in-page parser and expects it to return an array of rows. If the page evaluation returns anything other than an array (null, undefined, object), a CommandExecutionError is thrown because the parser contract was violated — usually meaning HLTV's page structure changed. Distinct from the empty-rows error that follows it.","triggerScenarios":"HLTV changed the team map-pool page markup so the page.evaluate returns undefined/null; page failed to render the expected widget and the parser returns a non-array; site serves an error/consent page instead of the data.","commonSituations":"HLTV frontend redesign breaking selectors; anti-bot or consent interstitial replacing content; network returning an error page parsed as non-array; library out of sync with current site markup.","solutions":["Update the library to a version matching current HLTV markup","Log/dump the raw evaluate result to see what shape actually came back","Retry later in case of a transient page/CDN issue","Add a fallback that inspects the page HTML for markup changes"],"exampleFix":"// before\nconst rawRows = await page.evaluate(parser, opts);\nif (!Array.isArray(rawRows)) throw new CommandExecutionError('unexpected shape');\n// after\nconst rawRows = await page.evaluate(parser, opts);\nif (!Array.isArray(rawRows)) {\n  console.error('parser returned:', typeof rawRows, rawRows); // diagnose markup change\n  throw new CommandExecutionError('hltv team-map-pool parser returned an unexpected shape');\n}","handlingStrategy":"retry","validationCode":"// pre-check the page actually rendered the map-pool section\nawait page.waitForSelector('div.stats-rows, .map-pool', { timeout: 15000 }).catch(() => null);","typeGuard":"function isArrayRows(v) { return Array.isArray(v) && v.every((r) => r && typeof r === 'object'); }","tryCatchPattern":"try {\n  await teamMapPool(page, { teamId, slug });\n} catch (err) {\n  if (err instanceof CommandExecutionError && /unexpected shape/.test(err.message)) {\n    await sleep(5000); // transient page issue; also suspect HLTV markup change\n    return retryOnce();\n  }\n  throw err;\n}","preventionTips":["Keep the library updated against HLTV markup changes","Pin and monitor the site structure; alert on parser shape failures","Retry transient failures before assuming a breaking change","Dump the raw evaluate result when this error fires to aid diagnosis"],"tags":["parser","hltv","page-structure","breaking-change"],"backgroundTag":"parser-output-shape-mismatch","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}