jackwener/OpenCLI · error · CommandExecutionError

Reddit subscriptions row ${index + 1} was missing data.

Error message

Reddit subscriptions row ${index + 1} was missing data.

What it means

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.

Source

Thrown at clis/reddit/subscribed.js:29

        throw new ArgumentError(
            `limit must be an integer in [1, ${REDDIT_SUBSCRIBED_MAX_LIMIT}].`,
            `Got: ${raw}`,
        );
    }
    return n;
}

export function unwrapEvaluateResult(payload) {
    if (payload && typeof payload === 'object' && !Array.isArray(payload) && 'session' in payload && 'data' in payload) {
        return payload.data;
    }
    return payload;
}

function mapSubredditRow(entry, index) {
    const data = entry?.data;
    if (!data || typeof data !== 'object') {
        throw new CommandExecutionError(`Reddit subscriptions row ${index + 1} was missing data.`);
    }
    const fullname = typeof data.name === 'string' ? data.name : '';
    const id = fullname.startsWith('t5_')
        ? fullname
        : (entry?.kind === 't5' && typeof data.id === 'string' && data.id ? `t5_${data.id}` : '');
    const displayName = typeof data.display_name === 'string' && data.display_name
        ? data.display_name
        : '';
    const subreddit = typeof data.display_name_prefixed === 'string' && data.display_name_prefixed
        ? data.display_name_prefixed
        : (displayName ? `r/${displayName}` : '');
    const path = typeof data.url === 'string' && data.url.startsWith('/r/') ? data.url : '';
    if (!id || !displayName || !subreddit || !path) {
        throw new CommandExecutionError(`Reddit subscriptions row ${index + 1} was missing subreddit identity.`);
    }
    return {
        id,
        subreddit,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command — transient malformed payloads often resolve on a second run
  2. Log into reddit.com and visit /subreddits/mine/subscriptions.json?raw_json=1 in the browser to inspect the actual payload shape
  3. Update the library to the latest version so row-mapping matches the current Reddit schema
  4. Check for browser extensions/proxies that could alter response bodies and disable them for reddit.com
Defensive patterns

Strategy: try-catch

Validate before calling

const me = await page.evaluate(`fetch('/api/me.json',{credentials:'include'}).then(r=>r.json())`);
if (!me?.data?.name) throw new Error('must be logged in to reddit.com');

Type guard

function isMissingRowDataErr(e){ return e instanceof Error && /was missing data\.$/.test(e.message); }

Try / catch

try { const rows = await cli.redditSubscribed({ limit }); }
catch (e) {
  if (/was missing data\.$/.test(e.message)) { console.warn('Reddit schema anomaly; retrying'); return retryOnce(); }
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: Reddit A/B-testing new payload shapes; authenticated session serving a different schema; proxy/extension mutating responses; transient Reddit API bugs during deploys.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/6b37ee21c79b5208. Report an issue: GitHub.