jackwener/OpenCLI · error · CommandExecutionError

String(data.error)

Error message

String(data.error)

What it means

The weibo post command's in-page script returned an object containing an `error` field, which the CLI converts to a string and rethrows as a CommandExecutionError. This means the page-side evaluation (scraping/posting step) reported a failure rather than returning data; the library surfaces the page's own error message verbatim so you can see what went wrong inside the browser context.

Source

Thrown at clis/weibo/post.js:69

          source: strip(s.source || ''),
          reposts: s.reposts_count || 0,
          comments: s.comments_count || 0,
          likes: s.attitudes_count || 0,
          pic_count: s.pic_num || 0,
          url: 'https://weibo.com/' + (u.id || '') + '/' + (s.mblogid || ''),
        };

        if (s.retweeted_status) {
          const rt = s.retweeted_status;
          result.retweeted_from = (rt.user?.screen_name || '[deleted]');
          result.retweeted_text = rt.text_raw || strip(rt.text || '');
        }

        return result;
      })()
    `)), 'weibo post');
        if (data.error)
            throw new CommandExecutionError(String(data.error));
        return Object.entries(data).map(([field, value]) => ({
            field,
            value: String(value),
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the wrapped message (String(data.error)) to see the underlying page-side failure
  2. Ensure you are logged into weibo.com in the controlled Chrome session and the page loaded fully
  3. Update the library in case Weibo changed its DOM and selectors were fixed upstream
  4. Re-run the command; transient page-load issues often resolve on retry

Example fix

// before: raw thrown error
throw new CommandExecutionError(String(data.error));
// after: guard before running by checking login/page state first
await getSelfUid(page); // throws AuthRequiredError early if not logged in
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof data === 'object' && data !== null && 'error' in data) {
  console.warn('page reported error:', String(data.error));
}

Type guard

function hasPageError(d) {
  return typeof d === 'object' && d !== null && 'error' in d && d.error != null;
}

Try / catch

try {
  await cli.run(['weibo', 'post']);
} catch (err) {
  if (err instanceof CommandExecutionError) {
    console.error('weibo post failed:', err.message);
    // re-check login/session before retrying
  } else throw err;
}

Prevention

When it happens

Trigger: Running the `weibo post` command when the page.evaluate script sets data.error — e.g. the target element was not found, the page structure changed, or the in-page action failed while data still returned.

Common situations: Weibo DOM changes breaking the injected script selectors; running while logged out so the expected data never renders; network hiccups causing partial page loads.

Related errors


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