{"record":{"id":"ef00cc1f18f01095","repo":"jackwener/OpenCLI","slug":"result-detail-ef00cc","errorCode":null,"errorMessage":"${result.detail}","messagePattern":"\\$\\{result\\.detail\\}","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/subscribed.js","lineNumber":151,"sourceCode":"          return { kind: 'malformed', detail: 'Reddit subscriptions pagination exceeded the safety cap before satisfying the requested limit.' };\n        }\n        return { kind: 'ok', entries: out };\n      } catch (e) {\n        return { kind: 'exception', detail: String(e && e.message || e) };\n      }\n    })()`));\n        if (result?.kind === 'login-wall') {\n            // Convert the browser-side sentinel into a typed LoginWallError on the Node side.\n            throwIfLoginWall(result.sentinel, { url: result.where });\n        }\n        if (result?.kind === 'auth') {\n            throw new AuthRequiredError('reddit.com', result.detail);\n        }\n        if (result?.kind === 'http') {\n            throw new CommandExecutionError(`HTTP ${result.httpStatus} from ${result.where}`);\n        }\n        if (result?.kind === 'malformed') {\n            throw new CommandExecutionError(result.detail);\n        }\n        if (result?.kind === 'exception') {\n            throw new CommandExecutionError(`subscribed failed: ${result.detail}`);\n        }\n        if (result?.kind !== 'ok' || !Array.isArray(result.entries)) {\n            throw new CommandExecutionError(`Unexpected result from reddit subscribed: ${JSON.stringify(result)}`);\n        }\n        const rows = result.entries.slice(0, limit).map((entry, index) => mapSubredditRow(entry, index));\n        if (rows.length === 0) {\n            throw new EmptyResultError('Reddit returned no subscribed subreddits for the logged-in account.');\n        }\n        return rows;\n    }\n});\n","sourceCodeStart":133,"sourceCodeEnd":166,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/subscribed.js#L133-L166","documentation":"subscribed.js throws CommandExecutionError(result.detail) when the page.evaluate result carries kind 'malformed', meaning the Reddit API response could not be parsed as the expected JSON shape (e.g. HTML/login-wall text instead of JSON, or missing data field). The CLI forwards the browser-side parse detail verbatim. It signals the response body did not match the subscribed-list schema.","triggerScenarios":"Reddit returns non-JSON (HTML error page, challenge page, empty body) to the in-page fetch; result = {kind:'malformed', detail:...} is converted at subscribed.js:151.","commonSituations":"Reddit serving an anti-bot HTML interstitial; being logged out mid-request so an HTML page is returned; Reddit CDN/proxy errors returning markup; blocked or unusual network (VPN) altering responses.","solutions":["Open reddit.com in the attached browser and confirm pages render normally (clears challenge/interstitial states).","Re-run the command once — transient proxy/CDN corruption is a common cause.","Log in / refresh the session if the malformed body is actually a login page.","Check network path (VPN, corporate proxy) that may inject or block content."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await run(['reddit', 'subscribed']);\n} catch (e) {\n  // 'malformed' detail indicates non-JSON response; log detail, retry once after browser check\n  console.error('Reddit returned non-JSON:', e.message);\n}","preventionTips":["Resolve any anti-bot/challenge pages in the browser before scripting","Avoid VPN/proxy paths that corrupt Reddit responses","Retry once on transient malformed responses","Verify logged-in state so Reddit returns JSON, not HTML login pages"],"tags":["parsing","reddit","malformed-response"],"backgroundTag":"malformed-json-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}