jackwener/OpenCLI · warning · EmptyResultError

No rows were found in the visible HLTV page

Error message

No rows were found in the visible HLTV page

What it means

assertRows throws EmptyResultError(command, 'No rows were found in the visible HLTV page') when the parser returned a valid array that is empty. The page loaded but no matching rows were extracted, usually because there is genuinely no data or the selectors no longer match.

Source

Thrown at clis/hltv/utils.js:853

  if (!Array.isArray(matrix)) return [];
  return matrix;
}

export async function gotoAndWait(page, url, selector, label) {
  try {
    await page.goto(url.toString(), { waitUntil: 'domcontentloaded', settleMs: 1000, timeout: 20000 });
    await page.wait({ selector, timeout: 15000 });
  } catch (error) {
    if (/timeout/i.test(String(error?.message ?? error))) {
      throw new TimeoutError(label, 15);
    }
    throw new CommandExecutionError(`${label} failed: ${error?.message ?? error}`);
  }
}

export function assertRows(rows, command) {
  if (!Array.isArray(rows)) throw new CommandExecutionError(`${command} parser returned an unexpected shape`);
  if (rows.length === 0) throw new EmptyResultError(command, 'No rows were found in the visible HLTV page');
  return rows;
}

export function assertRequiredFields(rows, command, fields) {
  assertRows(rows, command);
  for (const [index, row] of rows.entries()) {
    for (const field of fields) {
      if (row?.[field] === null || row?.[field] === undefined || row?.[field] === '') {
        throw new CommandExecutionError(`${command} parser returned row ${index + 1} without required ${field}`);
      }
    }
  }
  return rows;
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Relax or remove filters (event type, maps, date range) and retry
  2. Verify in a browser that the HLTV page actually shows data for the query
  3. If the page visibly has data, update the parser selectors for the new markup
  4. Handle EmptyResultError explicitly as 'no data' rather than a hard failure

Example fix

// before
const rows = assertRows(parseRankings(doc), 'rankings');
// after
try {
  const rows = assertRows(parseRankings(doc), 'rankings');
} catch (err) {
  if (err instanceof EmptyResultError) return [];
  throw err;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const rows = parseRows(doc);
if (Array.isArray(rows) && rows.length === 0) {
  console.warn(`${command}: no rows parsed — check filters or HLTV markup`);
}

Type guard

function hasRows(value) {
  return Array.isArray(value) && value.length > 0;
}

Try / catch

try {
  const rows = assertRows(parseRows(doc), command);
} catch (err) {
  if (err instanceof EmptyResultError) {
    console.warn(`${err.command}: ${err.message}`);
    return [];
  }
  throw err;
}

Prevention

When it happens

Trigger: An HLTV query with filters that match nothing (e.g. no events in range), or selectors failing to match after an HLTV markup change so zero rows are extracted.

Common situations: Filtering rankings/events too narrowly (top50 on a sparse period, rare map filters), a team/player with no recorded matches, or scraping right after an HLTV site update.

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/9f899e60d98cf1be. Report an issue: GitHub.