jackwener/OpenCLI · error · CommandExecutionError

String(data.error)

Error message

String(data.error)

What it means

clis/weibo/me.js:72 throws CommandExecutionError(String(data.error)) when the profile-fetch script returns a payload containing an error field — i.e. Weibo's API itself reported an error for the logged-in user's profile request. The message is Weibo's own error text (often Chinese), passed through verbatim.

Source

Thrown at clis/weibo/me.js:72

        if (!info.ok) return {error: 'API error'};
        const p = info.data?.user;
        if (!p) return {error: 'User data not found'};
        return {
          screen_name: p.screen_name,
          uid: p.id,
          followers: p.followers_count,
          following: p.friends_count,
          statuses: p.statuses_count,
          verified: p.verified || false,
          location: p.location || '',
          description: p.description || d.description || '',
          avatar: p.avatar_hd || p.avatar_large || '',
          profile_url: 'https://weibo.com' + (p.profile_url || '/u/' + p.id),
        };
      })()
    `)), 'weibo me');
        if (data.error)
            throw new CommandExecutionError(String(data.error));
        return data;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the included message — it is Weibo's own error text explaining the cause
  2. If it indicates login/session problems, re-login to weibo.com in the current Chrome browser
  3. Reload weibo.com and confirm the profile page loads; complete any security verification Weibo shows
  4. If the message references missing fields or unknown API errors, update the CLI to match current Weibo responses

Example fix

// before
const me = await cli.run('weibo me', {});
// after
try {
  const me = await cli.run('weibo me', {});
} catch (e) {
  if (e instanceof CommandExecutionError) console.error('weibo me failed:', e.message, '— try re-logging into weibo.com in Chrome');
  throw e;
}
Defensive patterns

Strategy: try-catch

Type guard

function isUpstreamWeiboError(e) { return e instanceof Error && e.name === 'CommandExecutionError' && !/^weibo me: HTTP/.test(e.message); }

Try / catch

try {
  const me = await cli.run('weibo me', {});
} catch (e) {
  if (isUpstreamWeiboError(e)) {
    console.error('Weibo returned:', e.message); // often login-related Chinese text
    // prompt user to re-login weibo.com in Chrome
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `weibo me` when the in-page request for the logged-in user's profile returns { error: ... } — typically an expired/invalid session (Weibo returns error text instead of a profile object) or an API-level rejection.

Common situations: Expired weibo.com cookies so the profile endpoint returns an error object; account restrictions or risk-control challenges; Weibo API changes renaming/moving fields so the script reads an error payload.

Related errors


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