jackwener/OpenCLI · error · CommandExecutionError
${command} parser returned row ${index + 1} without required
Error message
${command} parser returned row ${index + 1} without required ${field} What it means
assertRequiredFields walks every parsed row and throws CommandExecutionError('<command> parser returned row N without required <field>') when a row is missing a required field or it is null/undefined/''. It catches partial or malformed extraction after an HLTV markup change.
Source
Thrown at clis/hltv/utils.js:862
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
- Inspect which row/field is missing and update the parser mapping for that cell
- Skip or normalize rows that legitimately lack optional data before validation
- Upgrade the CLI if a newer release handles the current HLTV markup
- Make the field optional in the fields list if it is not truly required
Example fix
// before assertRequiredFields(rows, 'matches', ['date','team1','team2','score']); // after const cleaned = rows.filter(r => r.score != null && r.score !== ''); assertRequiredFields(cleaned, 'matches', ['date','team1','team2','score']);
Defensive patterns
Strategy: validation
Validate before calling
const required = ['date','team1','team2'];
const bad = rows.findIndex(r => required.some(f => r?.[f] == null || r?.[f] === ''));
if (bad !== -1) console.warn(`row ${bad + 1} missing required fields; filtering out`);
const clean = rows.filter(r => required.every(f => r?.[f] != null && r?.[f] !== '')); Type guard
function hasRequiredFields(row, fields) {
return !!row && typeof row === 'object' &&
fields.every(f => row[f] !== null && row[f] !== undefined && row[f] !== '');
} Try / catch
try {
assertRequiredFields(rows, command, fields);
} catch (err) {
if (err.name === 'CommandExecutionError' && /without required/.test(err.message)) {
console.warn(`${command}: dropping malformed rows — ${err.message}`);
return rows.filter(r => fields.every(f => r?.[f] != null && r?.[f] !== ''));
}
throw err;
} Prevention
- Filter out incomplete rows before strict validation
- Map HLTV cells defensively with nullish coalescing defaults
- Add tests with fixture HTML containing promo/odd rows
- Update parser mappings promptly after HLTV markup changes
When it happens
Trigger: A parser extracts rows but one or more rows lack a required key (e.g. row without 'team' or 'rating'), typically when HLTV renders optional cells or ad slots where data was expected.
Common situations: HLTV inserts promo/sponsored rows or changes column order; a single odd row (e.g. removed team) lacks a stat cell; new HLTV layout shifts field positions.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- ${command} parser returned an unexpected shape
- YouTube video metadata is missing membersOnly
- Barchart greeks returned an unreadable options payload${data
- PARSE_ERROR
- dianping search parser found result cards without shop_id va
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ad1024af3075ec16.
Report an issue: GitHub.