{"record":{"id":"b46c5e207a05e108","repo":"jackwener/OpenCLI","slug":"unexpected-result-from-reddit-subscribed-json-s","errorCode":null,"errorMessage":"Unexpected result from reddit subscribed: ${JSON.stringify(result)}","messagePattern":"Unexpected result from reddit subscribed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/subscribed.js","lineNumber":157,"sourceCode":"    })()`));\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":139,"sourceCodeEnd":166,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/subscribed.js#L139-L166","documentation":"If none of the known result kinds matched (not ok/auth/http/malformed/exception) or result.entries is not an array, subscribed.js throws CommandExecutionError including the full JSON of the result. This is a contract check: the browser probe returned an unrecognized shape, so the CLI refuses to guess and surfaces the raw payload for diagnosis. It usually indicates a version mismatch or unexpected Reddit response envelope.","triggerScenarios":"page.evaluate resolves to undefined/null or an object without kind/entries (e.g. older browser bridge, script truncated, evaluate failed silently); result.entries missing when kind==='ok'.","commonSituations":"Mismatched versions of the CLI and its browser extension/daemon; the evaluate promise rejected in a way producing undefined; Reddit returning ok with a differently shaped payload after an API change.","solutions":["Inspect the JSON dumped in the message to see the actual result shape.","Update both the CLI and the browser extension/daemon to matching versions so the sentinel contract holds.","Retry the command — a transient evaluate failure can yield an empty result.","If Reddit changed the payload, patch the scraper's kind/entries contract."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isWellFormedResult(r) {\n  return r != null && typeof r === 'object' && typeof r.kind === 'string' &&\n    (r.kind !== 'ok' || Array.isArray(r.entries));\n}","tryCatchPattern":"try {\n  await run(['reddit', 'subscribed']);\n} catch (e) {\n  if (e.message.startsWith('Unexpected result from reddit subscribed:')) {\n    const payload = JSON.parse(e.message.slice(e.message.indexOf(':') + 2));\n    log.debug('raw result', payload); // diagnose version mismatch\n  } else throw e;\n}","preventionTips":["Keep the CLI and its browser extension/daemon on matching versions","Retry transient evaluate failures that yield undefined results","Log the dumped JSON when this occurs to detect contract drift early","Prefer official release channels over mixed-version installs"],"tags":["contract-mismatch","reddit","unexpected-response"],"backgroundTag":"unexpected-response-shape","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}