{"record":{"id":"552343670cf0b016","repo":"jackwener/OpenCLI","slug":"formatlabel-citation-page-returned-an-empty-res","errorCode":null,"errorMessage":"${formatLabel} citation page returned an empty response","messagePattern":"(.+?) citation page returned an empty response","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/google-scholar/cite.js","lineNumber":69,"sourceCode":"            for (var i = 0; i < links.length; i++) {\n                if (links[i].textContent.trim() === '${formatLabel}') return links[i].href;\n            }\n            return null;\n        })()`);\n\n        if (!citeUrl) {\n            throw new CommandExecutionError(`Could not find ${formatLabel} citation link for result ${index + 1}`);\n        }\n\n        await page.goto(citeUrl);\n        await page.wait(2);\n\n        const citation = await page.evaluate(`(() => {\n            return (document.body.innerText || '').trim();\n        })()`);\n\n        if (!citation) {\n            throw new CommandExecutionError(`${formatLabel} citation page returned an empty response`);\n        }\n\n        return [{ title: clicked.title, format: format, citation }];\n    },\n});\n","sourceCodeStart":51,"sourceCodeEnd":75,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/google-scholar/cite.js#L51-L75","documentation":"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.","triggerScenarios":"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.","commonSituations":"Bulk citation harvesting triggering Scholar throttling; transient network failures; endpoint changes returning empty bodies instead of content.","solutions":["Retry the citation fetch after a short backoff","Slow the overall rate of Scholar requests to avoid throttling","Re-run the search and cite flow if the session went stale","Verify connectivity; capture the page URL/status to distinguish rate-limit pages"],"exampleFix":"// before\nconst citation = await scholarCite(page, i, 'bibtex');\n// after\ntry { citation = await scholarCite(page, i, 'bibtex'); }\ncatch (e) {\n  if (/empty response/.test(e.message)) { await page.wait(5); citation = await scholarCite(page, i, 'bibtex'); }\n  else throw e;\n}","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try { out = await scholarCite(page, i, fmt); }\ncatch (e) { if (/empty response/.test(e.message)) { await page.wait(5); out = await scholarCite(page, i, fmt); } else throw e; }","preventionTips":["Add backoff between citation fetches to avoid throttling","Retry transient empty responses after a short wait","Log the citeUrl on failure to diagnose rate-limit or endpoint changes"],"tags":["empty-response","google-scholar","citation"],"backgroundTag":"empty-response-body","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}