jackwener/OpenCLI · error · CommandExecutionError
${label} failed: ${error?.message ?? error}
Error message
${label} failed: ${error?.message ?? error} What it means
The HLTV adapter wraps any failure from a page-fetch/parse helper (goto, selector wait, network, HTTP) into a CommandExecutionError whose message is `${label} failed: <cause>`. If the underlying error message matches /timeout/i it is re-thrown as a TimeoutError instead, so this message means a non-timeout failure while scraping an HLTV page.
Source
Thrown at clis/hltv/utils.js:847
});
}
}
return entries;
});
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}`);
}
}
}View on GitHub (pinned to 49907e53dc)
Solutions
- Read the cause text after 'failed:' to identify the underlying error
- Check general network connectivity and whether hltv.org loads in a browser
- Retry later if HLTV is rate-limiting or serving a challenge page
- If the cause is a selector/navigation issue, verify the target HLTV URL is valid
Example fix
// before
const rows = await fetchHltvRows(...);
// after
try {
const rows = await fetchHltvRows(...);
} catch (err) {
if (err instanceof TimeoutError) retryWithBackoff();
else console.error('HLTV command failed:', err.message);
} Defensive patterns
Strategy: try-catch
Validate before calling
const url = new URL(target);
if (url.hostname !== 'hltv.org' && url.hostname !== 'www.hltv.org') {
throw new Error('URL must be an hltv.org page');
}
// also: quick reachability probe
const probe = await fetch(url, { method: 'HEAD' }).catch(() => null);
if (!probe || !probe.ok) throw new Error('hltv.org not reachable'); Type guard
function isCommandExecutionError(e) {
return e instanceof Error && e.name === 'CommandExecutionError';
} Try / catch
try {
const rows = await runHltvCommand(label, url);
} catch (err) {
if (/timeout/i.test(String(err?.message))) {
return retryWithBackoff(() => runHltvCommand(label, url));
}
if (err.name === 'CommandExecutionError') {
console.error(`${label} failed: ${err.message} — check hltv.org reachability`);
}
throw err;
} Prevention
- Pre-validate that URLs point at hltv.org before calling
- Probe hltv.org reachability (HEAD request) before batch scrapes
- Add backoff/retry for transient network and navigation failures
- Run scrapes from networks that are not blocked by HLTV/Cloudflare
When it happens
Trigger: page.goto throws (DNS failure, connection refused, HTTP error, navigation aborted), page.wait times out with a non-'timeout'-worded message, or the page object itself errors during the scrape of a given command label.
Common situations: HLTV.org is down or blocking the scraper (Cloudflare/captcha), no network access in CI, an invalid or redirecting URL, or the headless browser crashes mid-navigation.
Related errors
- Failed to read hupu hot threads: ${message}
- weixin search failed while loading Sogou results
- 1point3acres request failed: ${error?.message || error}
- 1point3acres request failed: HTTP ${res.status} ${res.status
- Barchart greeks request failed: HTTP ${data.status}${data.st
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/cfca1c7ebce170ca.
Report an issue: GitHub.