jackwener/OpenCLI · error · CommandExecutionError

${command} returned an unreadable browser payload

Error message

${command} returned an unreadable browser payload

What it means

requireRows inspects the browser payload produced by a scraping command. If the payload is null/undefined or not a plain object, the library cannot even interpret the result and throws this CommandExecutionError. It signals an internal/browser failure rather than bad user input — the page automation did not return a usable result object.

Source

Thrown at clis/dribbble/utils.js:69

    if (/^\d+$/.test(target)) return target;

    let url;
    try {
        url = new URL(target);
    } catch {
        throw new ArgumentError('shot must be a numeric id or dribbble.com/shots URL');
    }
    if (!/(^|\.)dribbble\.com$/i.test(url.hostname)) {
        throw new ArgumentError('shot URL must use dribbble.com');
    }
    const match = url.pathname.match(/^\/shots\/(\d+)(?:-|\/|$)/);
    if (!match) throw new ArgumentError('shot URL must match dribbble.com/shots/<id>');
    return match[1];
}

export function requireRows(payload, command) {
    if (!payload || typeof payload !== 'object') {
        throw new CommandExecutionError(`${command} returned an unreadable browser payload`);
    }
    if (payload.empty) {
        throw new EmptyResultError(command, payload.reason || `${command} returned no results`);
    }
    if (!payload.ok) {
        const reason = payload.reason ? `: ${payload.reason}` : '';
        throw new CommandExecutionError(`${command} selector drift${reason}`);
    }
    if (!Array.isArray(payload.rows)) {
        throw new CommandExecutionError(`${command} returned a malformed rows payload`);
    }
    if (payload.rows.length === 0) {
        throw new EmptyResultError(command, `${command} page loaded but no matching rows were found`);
    }
    return payload.rows;
}

export function requireRow(payload, command) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the command — a transient browser crash can produce an empty payload.
  2. Verify the browser automation dependency is installed and launches correctly (check its version and logs).
  3. Update the library/command scripts; an older payload shape may no longer match what requireRows expects.

Example fix

// before
const rows = cli.rows('shots', payload); // payload is null after a crash

// after
let rows;
try {
  rows = cli.rows('shots', payload);
} catch (e) {
  payload = await rerunBrowserCommand('shots');
  rows = cli.rows('shots', payload);
}
Defensive patterns

Strategy: retry

Validate before calling

if (payload == null || typeof payload !== 'object' || Array.isArray(payload)) {
  throw new Error('browser command must return an object payload before requireRows');
}

Type guard

function isBrowserPayload(p) {
  return p != null && typeof p === 'object' && !Array.isArray(p) && ('ok' in p || 'empty' in p || 'rows' in p);
}

Try / catch

try {
  rows = requireRows(payload, 'shots');
} catch (e) {
  if (e instanceof CommandExecutionError && /unreadable browser payload/.test(e.message)) {
    payload = await rerunBrowserCommand('shots'); // transient browser crash: retry once
    rows = requireRows(payload, 'shots');
  } else throw e;
}

Prevention

When it happens

Trigger: The headless browser command crashed or returned null/undefined; a custom/patched command returned a non-object (string, array at top level); the browser context was destroyed before the payload was serialized.

Common situations: Browser (Puppeteer/Playwright-style) not installed or failing to launch, page navigation failing so the command returns nothing, or running an outdated command script whose return shape changed.

Related errors


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