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
- Re-run the command — often transient (redirect, slow load).
- Run the site's login command first if AIbase now gates the daily page, so evaluation happens on the real page.
- Increase settle time / retry to let the page finish loading before extraction.
- 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
- Retry transient failures before debugging
- Complete site login if the daily page becomes gated
- Inspect what the daily URL renders when it persistently fails
- Keep the browser session fresh
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
- ${label} returned an unexpected payload shape; expected an a
- AIbase daily selector drift: ${reason}
- aibase news
- Unexpected SMZDM search extraction payload shape; expected a
- Not a git repository
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c74402dfa437f3dc.
Report an issue: GitHub.