jackwener/OpenCLI · error · CommandExecutionError

${formatLabel} citation page returned an empty response

Error message

${formatLabel} citation page returned an empty response

What it means

After navigating to the citation export URL (e.g. the BibTeX endpoint), the code reads document.body.innerText; if it is empty it throws CommandExecutionError `${formatLabel} citation page returned an empty response`. It means the remote citation page loaded but delivered no content.

Source

Thrown at clis/google-scholar/cite.js:69

            for (var i = 0; i < links.length; i++) {
                if (links[i].textContent.trim() === '${formatLabel}') return links[i].href;
            }
            return null;
        })()`);

        if (!citeUrl) {
            throw new CommandExecutionError(`Could not find ${formatLabel} citation link for result ${index + 1}`);
        }

        await page.goto(citeUrl);
        await page.wait(2);

        const citation = await page.evaluate(`(() => {
            return (document.body.innerText || '').trim();
        })()`);

        if (!citation) {
            throw new CommandExecutionError(`${formatLabel} citation page returned an empty response`);
        }

        return [{ title: clicked.title, format: format, citation }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the citation fetch after a short backoff
  2. Slow the overall rate of Scholar requests to avoid throttling
  3. Re-run the search and cite flow if the session went stale
  4. Verify connectivity; capture the page URL/status to distinguish rate-limit pages

Example fix

// before
const citation = await scholarCite(page, i, 'bibtex');
// after
try { citation = await scholarCite(page, i, 'bibtex'); }
catch (e) {
  if (/empty response/.test(e.message)) { await page.wait(5); citation = await scholarCite(page, i, 'bibtex'); }
  else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try { out = await scholarCite(page, i, fmt); }
catch (e) { if (/empty response/.test(e.message)) { await page.wait(5); out = await scholarCite(page, i, fmt); } else throw e; }

Prevention

When it happens

Trigger: page.goto(citeUrl) returning a blank/error body; Scholar rate limiting returning an empty page; network hiccup producing a truncated response; the 2s wait being insufficient for content injection.

Common situations: Bulk citation harvesting triggering Scholar throttling; transient network failures; endpoint changes returning empty bodies instead of content.

Related errors


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