jackwener/OpenCLI · error · CommandExecutionError
String(data.error)
Error message
String(data.error)
What it means
This error is thrown when a Weibo in-page evaluate returns an object containing an `error` field. The library wraps the raw error value with String() and rethrows it as a CommandExecutionError so CLI callers get a readable message instead of silently returning bad data.
Source
Thrown at clis/weibo/user.js:60
uid: u.id,
followers: u.followers_count,
following: u.friends_count,
statuses: u.statuses_count,
verified: u.verified || false,
verified_reason: u.verified_reason || '',
description: u.description || d.description || '',
location: u.location || '',
gender: u.gender === 'm' ? 'male' : u.gender === 'f' ? 'female' : '',
avatar: u.avatar_hd || u.avatar_large || '',
url: 'https://weibo.com' + (u.profile_url || '/u/' + u.id),
birthday: d.birthday || '',
created_at: d.created_at || '',
ip_location: d.ip_location || '',
};
})()
`)), 'weibo user');
if (data.error)
throw new CommandExecutionError(String(data.error));
return data;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command after re-authenticating the Weibo session (cookie/login may have expired).
- Update the weibo CLI to a version matching the current weibo.com DOM/API.
- Inspect the actual error text in the message — it is the raw in-page error surfaced verbatim.
- If developing the CLI, make the injected script throw instead of returning {error} so stack traces are preserved.
Example fix
// before
if (data.error) throw new CommandExecutionError(String(data.error));
// after
if (data?.error) throw new CommandExecutionError(`weibo user: ${String(data.error)}`); Defensive patterns
Strategy: try-catch
Validate before calling
const data = unwrapEvaluateResult(await page.evaluate(script));
if (data && typeof data === 'object' && 'error' in data) {
throw new Error(`weibo user in-page error: ${data.error}`);
} Type guard
function hasPayloadError(d) {
return d !== null && typeof d === 'object' && 'error' in d;
} Try / catch
try {
const user = await weiboUserCommand.run(uid);
} catch (err) {
if (err instanceof CommandExecutionError) {
console.error('Weibo extraction failed:', err.message);
// re-authenticate or fall back
} else throw err;
} Prevention
- Re-authenticate weibo.com sessions before long scraping runs
- Keep the CLI updated for Weibo DOM changes
- Log the raw evaluate payload when debugging
- Fail fast: check session validity before extraction
When it happens
Trigger: A page.evaluate() extraction in clis/weibo/user.js succeeds in returning an object, but that object carries an `error` property (e.g. the injected extraction script caught an in-page failure and returned {error: ...} instead of the user payload).
Common situations: Weibo DOM changes break the extraction script; the profile page returned an error/verify page; login expired so the injected script found no user data and reported an error.
Related errors
- Failed to upload image to ChatGPT: ${err instanceof Error ?
- Ctrip round-trip flight DOM extraction returned malformed ro
- Ctrip round-trip flight cards rendered but parser did not fi
- Ctrip round-trip flight rows were missing required airline/f
- Ctrip package DOM extraction returned malformed rows
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/265433866423eec6.
Report an issue: GitHub.