jackwener/OpenCLI · error · CommandExecutionError

${context} row ${index + 1} is missing ${field}.

Error message

${context} row ${index + 1} is missing ${field}.

What it means

requireNonEmptyRowField throws CommandExecutionError '<context> row N is missing <field>.' when a scraped row object exists but the required field (e.g. guild_id, channel_id, name) is empty after trimming. The CLI guarantees every returned row has non-empty key columns, so a blank required field is treated as a broken scrape.

Source

Thrown at clis/discord-app/utils.js:40

    }
    return value;
}

function requireArrayEvaluateResult(payload, context) {
    const value = unwrapEvaluateResult(payload);
    if (!Array.isArray(value)) {
        throw new CommandExecutionError(`${context} returned malformed browser output.`);
    }
    return value;
}

function requireNonEmptyRowField(row, field, context, index) {
    if (!row || typeof row !== 'object' || Array.isArray(row)) {
        throw new CommandExecutionError(`${context} returned malformed row ${index + 1}.`);
    }
    const value = String(row[field] || '').trim();
    if (!value) {
        throw new CommandExecutionError(`${context} row ${index + 1} is missing ${field}.`);
    }
    return value;
}

function requireRowsWithFields(rows, fields, context) {
    rows.forEach((row, index) => {
        fields.forEach((field) => requireNonEmptyRowField(row, field, context, index));
    });
    return rows;
}

export function isDiscordSnowflake(value) {
    return CHANNEL_ID_RE.test(String(value || '').trim());
}

export function normalizeDiscordName(value) {
    return String(value || '')
        .trim()

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Inspect the failing row's DOM in the automated browser and update the field extraction in the corresponding build*Script in clis/discord-app/utils.js
  2. Add fallback selectors (e.g. textContent, aria-label, data-id) so a missing attribute doesn't blank the field
  3. Re-run after full page load — lazily hydrated rows often populate later
  4. Skip or log rows with missing optional fields instead of failing, if the field is not essential for your use

Example fix

// row mapping inside the page script
// before
name: el.getAttribute('data-name') || '',
// after
name: (el.getAttribute('data-name') || el.getAttribute('aria-label') || el.textContent || '').trim(),
Defensive patterns

Strategy: validation

Validate before calling

function validateRowFields(rows, fields) {
  rows.forEach((r, i) => fields.forEach(f => {
    if (!String(r?.[f] || '').trim()) throw new Error(`Row ${i + 1} missing ${f}`);
  }));
}

Type guard

function hasField(row, field) {
  return typeof row === 'object' && row !== null && String(row[field] || '').trim().length > 0;
}

Try / catch

try {
  const rows = await discordAppThreads(page, { url });
} catch (err) {
  const m = String(err.message).match(/row (\d+) is missing (\w+)/);
  if (m) console.error(`Row ${m[1]} lacked ${m[2]}: update extraction selectors for that field.`);
  else throw err;
}

Prevention

When it happens

Trigger: A row object returned by a scrape script lacks a required property or has an empty/whitespace value — e.g. Discord rendered a row without an accessible label or ID, or the mapping script reads the wrong attribute yielding ''.

Common situations: Discord UI updates renaming data attributes/classes so row fields extract as empty strings; rows for unloaded/lazy entries that have a container but no text; scraping channels or servers with hidden names (aria-label changes).

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/a3635a09a90828b6. Report an issue: GitHub.