{"record":{"id":"6b37ee21c79b5208","repo":"jackwener/OpenCLI","slug":"reddit-subscriptions-row-index-1-was-missing","errorCode":null,"errorMessage":"Reddit subscriptions row ${index + 1} was missing data.","messagePattern":"Reddit subscriptions row (.+?) was missing data\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/reddit/subscribed.js","lineNumber":29,"sourceCode":"        throw new ArgumentError(\n            `limit must be an integer in [1, ${REDDIT_SUBSCRIBED_MAX_LIMIT}].`,\n            `Got: ${raw}`,\n        );\n    }\n    return n;\n}\n\nexport function unwrapEvaluateResult(payload) {\n    if (payload && typeof payload === 'object' && !Array.isArray(payload) && 'session' in payload && 'data' in payload) {\n        return payload.data;\n    }\n    return payload;\n}\n\nfunction mapSubredditRow(entry, index) {\n    const data = entry?.data;\n    if (!data || typeof data !== 'object') {\n        throw new CommandExecutionError(`Reddit subscriptions row ${index + 1} was missing data.`);\n    }\n    const fullname = typeof data.name === 'string' ? data.name : '';\n    const id = fullname.startsWith('t5_')\n        ? fullname\n        : (entry?.kind === 't5' && typeof data.id === 'string' && data.id ? `t5_${data.id}` : '');\n    const displayName = typeof data.display_name === 'string' && data.display_name\n        ? data.display_name\n        : '';\n    const subreddit = typeof data.display_name_prefixed === 'string' && data.display_name_prefixed\n        ? data.display_name_prefixed\n        : (displayName ? `r/${displayName}` : '');\n    const path = typeof data.url === 'string' && data.url.startsWith('/r/') ? data.url : '';\n    if (!id || !displayName || !subreddit || !path) {\n        throw new CommandExecutionError(`Reddit subscriptions row ${index + 1} was missing subreddit identity.`);\n    }\n    return {\n        id,\n        subreddit,","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/reddit/subscribed.js#L11-L47","documentation":"CommandExecutionError thrown by mapSubredditRow when an entry in the /subreddits/mine/subscriptions.json payload has no usable data object. The library maps each child row defensively and refuses to emit rows built from garbage, so a child missing .data aborts the command.","triggerScenarios":"Reddit returns a subscriptions Listing whose children array contains an entry with entry.data undefined or not an object (API shape change, error envelope nested in a child, non-t5 kinds).","commonSituations":"Reddit A/B-testing new payload shapes; authenticated session serving a different schema; proxy/extension mutating responses; transient Reddit API bugs during deploys.","solutions":["Retry the command — transient malformed payloads often resolve on a second run","Log into reddit.com and visit /subreddits/mine/subscriptions.json?raw_json=1 in the browser to inspect the actual payload shape","Update the library to the latest version so row-mapping matches the current Reddit schema","Check for browser extensions/proxies that could alter response bodies and disable them for reddit.com"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const me = await page.evaluate(`fetch('/api/me.json',{credentials:'include'}).then(r=>r.json())`);\nif (!me?.data?.name) throw new Error('must be logged in to reddit.com');","typeGuard":"function isMissingRowDataErr(e){ return e instanceof Error && /was missing data\\.$/.test(e.message); }","tryCatchPattern":"try { const rows = await cli.redditSubscribed({ limit }); }\ncatch (e) {\n  if (/was missing data\\.$/.test(e.message)) { console.warn('Reddit schema anomaly; retrying'); return retryOnce(); }\n  throw e;\n}","preventionTips":["Keep the library updated for Reddit schema changes","Use a clean authenticated session without body-rewriting extensions/proxies","Retry once on transient malformed payloads","Inspect subscriptions.json?raw_json=1 in the browser when it recurs"],"tags":["reddit","malformed-response","schema-change"],"backgroundTag":"schema-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}