jackwener/OpenCLI · error · CommandExecutionError
message
Error message
message
What it means
If the underlying error message is non-empty and does not match the auth keyword pattern, mapError() wraps it verbatim in a CommandExecutionError. Error [4465] with message 'message' corresponds to this generic wrap: the thrown error text is the raw underlying message passed through as-is.
Source
Thrown at clis/weibo/user-posts.js:70
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',
description: 'List Weibo posts from a user, optionally filtered by date range',
domain: 'weibo.com',
strategy: Strategy.COOKIE,
args: [
{ name: 'id', positional: true, required: true, help: 'User ID (numeric uid) or screen name' },View on GitHub (pinned to 49907e53dc)
Solutions
- Read the wrapped message for the real cause and address that underlying problem.
- Retry the command; transient network/loading failures often succeed on a second run.
- Check whether the Weibo page structure changed, which would break extraction selectors.
- Ensure the page can fully load (stable network, no aggressive proxy blocking weibo assets).
Defensive patterns
Strategy: retry
Type guard
function isCommandExecutionError(e) {
return e && e.name === 'CommandExecutionError';
} Try / catch
try {
return await runUserPosts(opts);
} catch (err) {
if (err instanceof CommandExecutionError && !/auth|login/i.test(err.message)) {
await sleep(3000);
return runUserPosts(opts); // single retry for transient failures
}
throw err;
} Prevention
- Use a reliable, unrestricted network path to weibo.com.
- Rate-limit requests to avoid anti-scraping interstitials.
- Keep the CLI updated against Weibo DOM changes.
- Log the full error message to identify the underlying cause.
When it happens
Trigger: Any extraction failure whose text lacks login/cookie/auth/forbidden/permission/unauthorized keywords — e.g. timeouts, selector misses, navigation errors — reaches mapError and is rethrown as CommandExecutionError(message).
Common situations: Weibo DOM changes breaking the page-side extractor, slow page loads timing out, transient network failures, or anti-scraping interstitials.
Related errors
- weibo delete: ${String(result.msg ?? result.error)}
- weibo delete returned an unexpected response
- String(data.error)
- weibo user-posts returned malformed extraction payload
- weibo user-posts did not observe a valid posts list
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/47a1b406a7be0e19.
Report an issue: GitHub.