jackwener/OpenCLI · error · CommandExecutionError

Reddit /comments fetch returned no result envelope.

Error message

Reddit /comments fetch returned no result envelope.

What it means

After running the in-page browser script that fetches Reddit's /comments endpoint, the host command checks the returned envelope. If the script returned null/undefined or a non-object (e.g. the page navigated away, the script threw at top level, or serialization failed), a CommandExecutionError is thrown because no result envelope exists to interpret.

Source

Thrown at clis/reddit/read.js:563

            url_overridden_by_dest: '',
            preview_image_url: '',
            gallery_urls: [],
          });
        }

        // If we produced nothing beyond the POST row but the comment listing
        // wasn't empty, that's parser drift (e.g. Reddit changed t1/more
        // schema). Surface as CommandExecutionError on the Node side.
        if (rows.length <= 1 && preWalkSize > 0 && t1TopLevel.length > 0) {
          return { kind: 'parser-drift', detail: 'Reddit comment listing for post ' + postId + ' had ' + t1TopLevel.length + ' t1 entries but walker produced no rows.' };
        }

        return { kind: 'ok', rows: rows, expandMeta: expandMeta };
      })()
    `);

        if (!result || typeof result !== 'object') {
            throw new CommandExecutionError('Reddit /comments fetch returned no result envelope.');
        }
        if (result.kind === 'inaccessible') {
            throw new EmptyResultError(result.detail);
        }
        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 === 'parser-drift') {
            throw new CommandExecutionError(result.detail);
        }
        if (result.kind === 'expand-failed') {
            throw new CommandExecutionError(result.detail);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the command; transient page/automation failures often resolve on retry.
  2. Check that the browser session is alive and cookies (Strategy.COOKIE auth) are still valid.
  3. Inspect for Reddit blocking/interstitial pages and retry from a normal browser to verify access.
Defensive patterns

Strategy: retry

Validate before calling

if (!browserAlive || page.isClosed?.()) await restartBrowserSession();

Type guard

null

Try / catch

try {
  const rows = await redditRead(postId);
} catch (e) {
  if (e instanceof CommandExecutionError && /no result envelope/.test(e.message)) {
    await sleep(2000);
    return redditRead(postId); // retry once
  }
  throw e;
}

Prevention

When it happens

Trigger: The injected page script crashes before producing its result object, the browser page navigates/closes mid-evaluation, or the evaluation returns undefined due to a syntax/runtime failure in the IIFE.

Common situations: Reddit serving an unexpected interstitial (login wall, block page) that breaks the script; flaky browser automation; a library/version update changing the script's return shape.

Related errors


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