jackwener/OpenCLI · error · CommandExecutionError

weibo user-posts failed without an error message

Error message

weibo user-posts failed without an error message

What it means

mapError() converts underlying extraction/browser errors into typed CLI errors. When the error value is null/undefined or stringifies to an empty/whitespace-only string, the library has no message to report, so it throws this CommandExecutionError. It exists so failures are never silently swallowed with an uninformative cause.

Source

Thrown at clis/weibo/user-posts.js:65

    }).formatToParts(date);
    const get = (type) => parts.find((part) => part.type === type)?.value;
    return `${get('year')}-${get('month')}-${get('day')}`;
}

function dateToTimestamp(date) {
    return Math.floor(new Date(`${date}T00:00:00+08:00`).getTime() / 1000);
}

function validateRange(start, end) {
    if (start && end && dateToTimestamp(start) > dateToTimestamp(end)) {
        throw new ArgumentError('weibo user-posts start must be <= end');
    }
}

function mapError(error) {
    const message = String(error ?? '').trim();
    if (!message) {
        throw new CommandExecutionError('weibo user-posts failed without an error message');
    }
    if (/login|cookie|登录|auth|forbidden|permission|权限|unauthorized/i.test(message)) {
        throw new AuthRequiredError('weibo.com', message);
    }
    throw new CommandExecutionError(message);
}

export const testInternals = {
    readRequiredId,
    readLimit,
    readDate,
    dateToTimestamp,
};

cli({
    site: 'weibo',
    name: 'user-posts',
    access: 'read',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the command to see if the transient empty error recurs.
  2. Run with verbose/debug logging to capture the underlying browser/network state at failure time.
  3. Check network connectivity and whether weibo.com is reachable from your environment.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await runUserPosts({ id, start, end });
} catch (err) {
  if (err instanceof CommandExecutionError && /failed without an error message/.test(err.message)) {
    // retry once or enable verbose logging to diagnose
  } else throw err;
}

Prevention

When it happens

Trigger: The in-page extraction returns {error: null} or {error: ''}, or an exception object with no message reaches mapError from the payload.error branch.

Common situations: Page scripts failing before producing a message (navigation aborted, evaluate returned an undefined error), or upstream code replacing a real error with undefined.

Related errors


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