jackwener/OpenCLI · error · CommandExecutionError

rawResult.error + (rawResult.hint ? ` (${rawResult.hint})` :

Error message

rawResult.error + (rawResult.hint ? ` (${rawResult.hint})` : '')

What it means

Thrown when the in-page article probe returns an envelope with an explicit error field (and optionally a hint). The CLI surfaces error + hint verbatim as a CommandExecutionError. It indicates the page script detected a failure (e.g. not logged in, element missing) and reported it through the result object instead of an HTTP status.

Source

Thrown at clis/twitter/article.js:256

          title,
          author: screenName,
          content: parts.join('\\n\\n') || legacy.full_text || '',
          url: 'https://x.com/' + screenName + '/status/' + tweetId,
        }];
      }
    `));
        if (!Array.isArray(rawResult) && !isPlainObject(rawResult)) {
            throw new CommandExecutionError('Twitter article response payload is malformed');
        }
        if (rawResult?.httpStatus) {
            const message = describeTwitterApiError('TweetResultByRestId', rawResult.httpStatus);
            if (rawResult.httpStatus === 401 || rawResult.httpStatus === 403) {
                throw new AuthRequiredError('x.com', message);
            }
            throw new CommandExecutionError(message);
        }
        if (rawResult?.error) {
            throw new CommandExecutionError(rawResult.error + (rawResult.hint ? ` (${rawResult.hint})` : ''));
        }
        if (!Array.isArray(rawResult)) {
            throw new CommandExecutionError('Twitter article response payload is malformed');
        }
        return rawResult;
    }
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the error/hint text in the message — it states the concrete cause.
  2. Re-authenticate with x.com via the CLI's auth/login command if the hint mentions login or cookies.
  3. Retry with a logged-in browser session and confirm the tweet opens normally in the browser.
  4. Update the CLI if Twitter changed its DOM; a stale extractor can report errors.

Example fix

// before
const rows = await cli.run('twitter article <url>');
// after
try {
  const rows = await cli.run('twitter article <url>');
} catch (e) {
  if (/logged in|cookies/i.test(e.message)) await cli.run('auth login x.com');
  else throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!browserSessionActive()) await startBrowserAndLogin('x.com');

Type guard

function isApiErrorEnvelope(r) {
  return r !== null && typeof r === 'object' && typeof r.error === 'string';
}

Try / catch

try {
  const rows = await cli.run('twitter article <url>');
} catch (e) {
  if (/logged in|cookies|auth/i.test(e.message)) await cli.run('auth login x.com');
  else throw e;
}

Prevention

When it happens

Trigger: The browser-side script returned { error: ..., hint?: ... } from the page.evaluate result — e.g. article DOM not found, user not authenticated, or tweet body unavailable.

Common situations: Expired or missing x.com session cookies, viewing a protected account's tweet while not following, or Twitter DOM changes that break the article extractor selectors.

Related errors


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