{"record":{"id":"d88e9fa947697134","repo":"jackwener/OpenCLI","slug":"linux-do-returned-an-empty-browser-response-d88e9f","errorCode":null,"errorMessage":"linux.do returned an empty browser response","messagePattern":"linux\\.do returned an empty browser response","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linux-do/topic-content.js","lineNumber":107,"sourceCode":"        data = await res.json();\n      } catch (_error) {\n        data = null;\n      }\n      return {\n        ok: res.ok,\n        status: res.status,\n        data,\n        error: data === null ? 'Response is not valid JSON' : '',\n      };\n    } catch (error) {\n      return {\n        ok: false,\n        error: error instanceof Error ? error.message : String(error),\n      };\n    }\n  })()`);\n    if (!result) {\n        throw new CommandExecutionError('linux.do returned an empty browser response');\n    }\n    if (result.status === 401 || result.status === 403) {\n        throw new AuthRequiredError(LINUX_DO_DOMAIN, 'linux.do requires an active signed-in browser session');\n    }\n    if (result.error === 'Response is not valid JSON') {\n        throw new AuthRequiredError(LINUX_DO_DOMAIN, 'linux.do requires an active signed-in browser session');\n    }\n    if (!result.ok) {\n        throw new CommandExecutionError(result.error || `linux.do request failed: HTTP ${result.status ?? 'unknown'}`);\n    }\n    if (result.error) {\n        throw new CommandExecutionError(result.error, 'Please verify your linux.do session is still valid');\n    }\n    return result.data;\n}\ncli({\n    site: 'linux-do',\n    name: 'topic-content',","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linux-do/topic-content.js#L89-L125","documentation":"fetchTopicPayload runs in-browser fetch code and expects a JSON result object. If the browser evaluation returns nothing (null/undefined), the library cannot proceed and throws a CommandExecutionError indicating the browser response was empty.","triggerScenarios":"The injected page.evaluate script returns undefined/null — e.g. navigation cancelled, page closed mid-fetch, the async IIFE throwing before returning an object and the harness swallowing it, or the tab being redirected away from linux.do.","commonSituations":"User closes the browser/tab during fetch; a popup or login redirect aborts the evaluate; headless browser crash; network offline causing the fetch to be aborted without a status.","solutions":["Re-run the command; transient navigation interruptions often disappear on retry.","Ensure the browser page stays open and on a linux.do domain during the fetch.","Confirm network connectivity and that linux.do is reachable.","Check the CLI's browser automation setup (Playwright/CDP) for navigation guards or timeouts."],"exampleFix":"// before\nconst result = await page.evaluate(fetchScript);\nconst content = extractTopicContent(result.data, id);\n// after\nconst result = await page.evaluate(fetchScript);\nif (!result || !result.data) {\n  throw new Error('Empty browser response — keep the linux.do tab open and retry');\n}\nconst content = extractTopicContent(result.data, id);","handlingStrategy":"retry","validationCode":"if (!page || page.isClosed?.()) {\n  throw new Error('Browser page unavailable before topic fetch');\n}","typeGuard":"const isBrowserResult = (r) => r !== null && r !== undefined && typeof r === 'object' && 'status' in r;","tryCatchPattern":"try {\n  return await fetchTopicPayload(page, id);\n} catch (e) {\n  if (e instanceof CommandExecutionError && /empty browser response/.test(e.message)) {\n    await page.goto(LINUX_DO_URL).catch(() => {});\n    return fetchTopicPayload(page, id); // one retry\n  } else throw e;\n}","preventionTips":["Keep the tab open and on linux.do during fetches","Retry transient empty responses once","Watch for navigation/redirects aborting evaluate"],"tags":["browser-automation","network","empty-result"],"backgroundTag":"empty-browser-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}