jackwener/OpenCLI · error · CommandExecutionError

UISDC news page returned an unreadable payload

Error message

UISDC news page returned an unreadable payload

What it means

toRows validates the payload returned by the in-page extraction script. If the payload is null, undefined, or not an object, it throws CommandExecutionError 'UISDC news page returned an unreadable payload', meaning page.evaluate did not return the expected structured result.

Source

Thrown at clis/uisdc/news.js:54

          };
        }
        const rows = cards.map((el, index) => {
          const anchor = el.querySelector('a[href]');
          return {
            rank: index + 1,
            title: el.querySelector('.dubao-title')?.textContent || '',
            summary: el.querySelector('.dubao-content')?.textContent || '',
            url: anchor ? new URL(anchor.getAttribute('href'), location.href).href : '',
          };
        });
        return { ok: true, rows };
      })()
    `;
}

function toRows(payload, limit) {
    if (!payload || typeof payload !== 'object') {
        throw new CommandExecutionError('UISDC news page returned an unreadable payload');
    }
    if (!payload.ok) {
        const reason = typeof payload.reason === 'string' && payload.reason.trim() ? payload.reason.trim() : 'selector-drift';
        throw new CommandExecutionError(
            `UISDC news selector drift: ${reason}`,
            payload.title ? `Page title: ${payload.title}` : undefined,
        );
    }
    const rows = (Array.isArray(payload.rows) ? payload.rows : [])
        .map((row, index) => ({
            rank: index + 1,
            title: normalizeText(row.title),
            summary: normalizeText(row.summary),
            url: normalizeText(row.url),
        }))
        .filter((row) => row.title && row.url);
    if (rows.length === 0) {
        throw new EmptyResultError('uisdc news', 'UISDC news page loaded, but no news rows with title and URL were extracted.');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command; transient redirects or slow loads often resolve on a second run
  2. Check that UISDC_NEWS_URL loads normally in a browser (not blocked or redirected)
  3. Inspect the page's anti-bot behavior; use a visible/headed browser if the site blocks automation
  4. File/inspect buildExtractUisdcNewsJs to ensure it always returns an object
Defensive patterns

Strategy: try-catch

Validate before calling

const payload = await page.evaluate(js).catch(() => null);
if (!payload || typeof payload !== 'object') throw new Error('extraction returned no object');

Type guard

function isReadablePayload(p) { return !!p && typeof p === 'object' && !Array.isArray(p); }

Try / catch

try { const rows = await loadUisdcNews(page, args); } catch (e) { if (/unreadable payload/.test(e.message)) { await retryWithFreshPage(); } else throw e; }

Prevention

When it happens

Trigger: page.evaluate(buildExtractUisdcNewsJs()) resolving to null/undefined or a non-object (e.g. a serialized string), or the injected script returning nothing after navigation problems.

Common situations: Page redirected to an error/login/captcha page so the extractor returned undefined; automation framework serialization quirk; SPA rewrote the DOM before the script's guarded return.

Related errors


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