jackwener/OpenCLI · error · CommandExecutionError

AIbase daily page returned an unreadable payload

Error message

AIbase daily page returned an unreadable payload

What it means

toRows throws this CommandExecutionError when the payload returned from the injected page.evaluate extraction script is null, undefined, or not an object — i.e. the AIbase daily page yielded nothing usable to interpret. It is distinct from selector drift (which produces a structured {ok:false} payload); here the script returned nothing structured at all.

Source

Thrown at clis/aibase/news.js:60

        const rows = [];
        for (const anchor of anchors) {
          const url = new URL(anchor.getAttribute('href'), location.href).href;
          if (seen.has(url)) continue;
          seen.add(url);
          rows.push({
            rank: rows.length + 1,
            title: anchor.innerText || anchor.textContent || '',
            url,
          });
        }
        return { ok: true, rows };
      })()
    `;
}

function toRows(payload, limit) {
    if (!payload || typeof payload !== 'object') {
        throw new CommandExecutionError('AIbase daily 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(
            `AIbase daily 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),
            url: normalizeText(row.url),
        }))
        .filter((row) => row.title && row.url);
    if (rows.length === 0) {
        throw new EmptyResultError('aibase news', 'AIbase daily page loaded, but no article rows with title and URL were extracted.');
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the command — often transient (redirect, slow load).
  2. Run the site's login command first if AIbase now gates the daily page, so evaluation happens on the real page.
  3. Increase settle time / retry to let the page finish loading before extraction.
  4. Inspect the page manually (or in foreground mode) to see what the daily URL actually renders now; update the extraction script if the page changed fundamentally.

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// ensure the page is reachable and not an interstitial
const res = await fetch('https://www.aibase.com/zh/daily', { redirect: 'follow' });
const html = await res.text();
if (!html.includes('daily')) console.warn('Daily page may be an interstitial or redirected');

Type guard

function isUsablePayload(p) {
  return p !== null && typeof p === 'object';
}

Try / catch

try {
  await runCommand(['aibase', 'news']);
} catch (e) {
  if (e instanceof CommandExecutionError && e.message.includes('unreadable payload')) {
    console.error('Extraction returned nothing; retrying after backoff');
  } else throw e;
}

Prevention

When it happens

Trigger: page.evaluate resolves to null/undefined or a primitive — e.g. the script failed to return, the page navigated/reloaded during evaluation, or the browser wrapper returned a non-object (or an ununwrap-able envelope whose data is null).

Common situations: Page redirected to a captcha/login/consent interstitial so the script context produced nothing; browser crashed mid-evaluation and the wrapper returned undefined; network served an error page that short-circuits the script; running against a cached/stale session.

Related errors


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