jackwener/OpenCLI · error · CommandExecutionError
gov-policy ${command} page did not expose readable result ro
Error message
gov-policy ${command} page did not expose readable result rows What it means
Thrown by classifyExtractorFailure as the fallback when the extractor ran but the page contained no readable result rows and (for search) no empty-result pattern matched. This means the command could not tell whether there were results — the page DOM didn't match the selectors, or it never finished rendering. Wrapped as CommandExecutionError with any url/sample context captured.
Source
Thrown at clis/gov-policy/utils.js:33
if (!Number.isInteger(limit) || limit < 1) {
throw new ArgumentError(`gov-policy ${command} --limit must be a positive integer`);
}
if (limit > 20) {
throw new ArgumentError(`gov-policy ${command} --limit must be <= 20`);
}
return limit;
}
export function classifyExtractorFailure(command, result) {
const sample = String(result?.sample || '').replace(/\s+/g, ' ').trim();
const url = String(result?.url || '').trim();
if (command === 'search' && EMPTY_RESULT_PATTERNS.some((pattern) => pattern.test(sample))) {
throw new EmptyResultError('gov-policy search', sample ? sample.slice(0, 160) : undefined);
}
const context = [url && `url=${url}`, sample && `sample=${sample.slice(0, 160)}`]
.filter(Boolean)
.join('; ');
throw new CommandExecutionError(
`gov-policy ${command} page did not expose readable result rows`,
context || 'The page structure may have changed or the page did not finish rendering.',
);
}
export function requireRows(command, rows) {
if (!Array.isArray(rows) || rows.length === 0) {
throw new CommandExecutionError(
`gov-policy ${command} extractor returned no result rows`,
'The page structure may have changed or all result cards were missing required title fields.',
);
}
return rows;
}
export function wrapBrowserError(command, error) {
if (error instanceof ArgumentError || error instanceof EmptyResultError || error instanceof CommandExecutionError) {
throw error;View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command — transient rendering/timing issues often resolve
- Increase patience for page load if the CLI exposes a wait/timeout option, or retry on a faster connection
- Check the captured url/sample in the error context in a browser to see what the page actually shows
- Report a possible site structure change to the adapter maintainers with the context string
Example fix
// before
await runGovPolicy('search', { q: 'data security' });
// after
try { await runGovPolicy('search', { q: '数据安全' }); }
catch (e) { await sleep(3000); await runGovPolicy('search', { q: '数据安全' }); } // retry once for render lag Defensive patterns
Strategy: retry
Validate before calling
// Preflight: confirm the page renders result rows
await page.goto(url, { waitUntil: 'networkidle2' });
const hasRows = await page.evaluate(() => document.querySelectorAll('.result-item, .list-item').length > 0);
if (!hasRows) console.warn('No result rows rendered; extraction may fail'); Type guard
function isReadableExtractorResult(r) { return r && typeof r.sample === 'string' && r.sample.trim().length > 0; } Try / catch
try {
const rows = await govPolicyExtract(command, args);
} catch (err) {
if (/did not expose readable result rows/.test(err.message)) {
await sleep(3000); // allow JS rendering
return govPolicyExtract(command, args); // retry once
}
throw err;
} Prevention
- Retry once after a delay to accommodate slow JS rendering
- Inspect the url/sample context in the error to diagnose page changes
- Keep adapter selectors updated against site redesigns
- Report recurring failures with the captured context to maintainers
When it happens
Trigger: Calling any gov-policy subcommand where result.sample lacks the expected result-card structure and no EMPTY_RESULT_PATTERNS phrase is present: selector mismatch after a site redesign, JS-rendered content not yet loaded at extraction time, or a bot-check/interstitial page served instead of results.
Common situations: gov-policy site layout change, very slow network so content hasn't rendered when the extractor samples the DOM, anti-bot challenge pages, wrong command targeting a page type the extractor doesn't know.
Related errors
- gov-policy ${command} extractor returned no result rows
- coupang product extraction failed: ${error?.message || error
- coupang search filter evaluation failed: ${error?.message ||
- gov-policy search
- gov-policy ${command} browser extraction failed: ${error?.me
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/766d58d19976cff7.
Report an issue: GitHub.