jackwener/OpenCLI · error · CommandExecutionError

${result.detail}

Error message

${result.detail}

What it means

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.

Source

Thrown at clis/reddit/subscribed.js:151

          return { kind: 'malformed', detail: 'Reddit subscriptions pagination exceeded the safety cap before satisfying the requested limit.' };
        }
        return { kind: 'ok', entries: out };
      } catch (e) {
        return { kind: 'exception', detail: String(e && e.message || e) };
      }
    })()`));
        if (result?.kind === 'login-wall') {
            // Convert the browser-side sentinel into a typed LoginWallError on the Node side.
            throwIfLoginWall(result.sentinel, { url: result.where });
        }
        if (result?.kind === 'auth') {
            throw new AuthRequiredError('reddit.com', result.detail);
        }
        if (result?.kind === 'http') {
            throw new CommandExecutionError(`HTTP ${result.httpStatus} from ${result.where}`);
        }
        if (result?.kind === 'malformed') {
            throw new CommandExecutionError(result.detail);
        }
        if (result?.kind === 'exception') {
            throw new CommandExecutionError(`subscribed failed: ${result.detail}`);
        }
        if (result?.kind !== 'ok' || !Array.isArray(result.entries)) {
            throw new CommandExecutionError(`Unexpected result from reddit subscribed: ${JSON.stringify(result)}`);
        }
        const rows = result.entries.slice(0, limit).map((entry, index) => mapSubredditRow(entry, index));
        if (rows.length === 0) {
            throw new EmptyResultError('Reddit returned no subscribed subreddits for the logged-in account.');
        }
        return rows;
    }
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open reddit.com in the attached browser and confirm pages render normally (clears challenge/interstitial states).
  2. Re-run the command once — transient proxy/CDN corruption is a common cause.
  3. Log in / refresh the session if the malformed body is actually a login page.
  4. Check network path (VPN, corporate proxy) that may inject or block content.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await run(['reddit', 'subscribed']);
} catch (e) {
  // 'malformed' detail indicates non-JSON response; log detail, retry once after browser check
  console.error('Reddit returned non-JSON:', e.message);
}

Prevention

When it happens

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

Common situations: 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.

Related errors


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