jackwener/OpenCLI · error · CommandExecutionError
Jike notifications API failed: ${String(body?.error || body?
Error message
Jike notifications API failed: ${String(body?.error || body?.message || 'malformed response')} What it means
fetchNotificationsPage posts to the Jike notifications API and requires a body that is an object with success !== false and a `data` array. Anything else (null body, non-object, success:false, missing data array) is treated as an API failure and wrapped in CommandExecutionError, including whatever error/message the server supplied.
Source
Thrown at clis/jike/notifications.js:89
: '';
const time = typeof notification.createdAt === 'string'
? notification.createdAt
: (typeof notification.updatedAt === 'string' ? notification.updatedAt : '');
return {
type: resolveActionLabel(notification, actionItem),
user: names.join('、'),
content: cleanContent(actionItem.content || referenceContent),
time,
};
}
async function fetchNotificationsPage(page, loadMoreKey) {
const body = await postJikeApi(page, API_PATH, {
limit: PAGE_SIZE,
...(loadMoreKey ? { loadMoreKey } : {}),
}, 'Jike notifications API');
if (!body || typeof body !== 'object' || body.success === false || !Array.isArray(body.data)) {
throw new CommandExecutionError(`Jike notifications API failed: ${String(body?.error || body?.message || 'malformed response')}`);
}
return body;
}
async function listNotifications(page, limit) {
const rows = [];
const seenIds = new Set();
const seenCursors = new Set();
let loadMoreKey = null;
for (let pageIndex = 0; pageIndex < MAX_PAGES; pageIndex++) {
const body = await fetchNotificationsPage(page, loadMoreKey);
for (const notification of body.data) {
const row = mapNotification(notification);
if (seenIds.has(notification.id)) continue;
seenIds.add(notification.id);
rows.push(row);
if (rows.length >= limit) return rows;
}View on GitHub (pinned to 49907e53dc)
Solutions
- Re-authenticate / refresh the Jike credentials or session token
- Check the embedded error/message in the thrown error and inspect the raw response for details
- Retry after a delay if it is a rate-limit or transient outage (429/5xx)
- Update the CLI to match any Jike API envelope changes
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check session/auth before calling
if (!process.env.JIKE_TOKEN) throw new Error('JIKE_TOKEN not set'); Type guard
function isNotificationsBody(b) {
return b !== null && typeof b === 'object' && b.success !== false && Array.isArray(b.data);
} Try / catch
try {
await cli('jike', 'notifications').run();
} catch (e) {
if (String(e.message).startsWith('Jike notifications API failed:')) {
await sleep(2000); // backoff then retry once
} else throw e;
} Prevention
- Refresh Jike credentials before long-running jobs
- Add exponential backoff for 429/5xx responses
- Monitor Jike API status for outages
When it happens
Trigger: The Jike notifications endpoint returns success:false with an error message, an HTML error page instead of JSON, a 200 response missing the data array, rate-limit responses, or auth-expiry payloads that lack the expected envelope.
Common situations: Expired or revoked Jike session token, Jike rate limiting, Jike API outage or maintenance, network proxy returning an HTML error page, Jike changing the response envelope in a new API version.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Jike search API failed: ${String(body?.message || 'malformed
- Bilibili ${label} API returned a malformed payload
- Bilibili ${label} API failed: ${message} (${payload.code})
- coingecko global returned malformed JSON: ${err?.message ??
- 抖音封面申请上传地址响应缺少 UploadHost/StoreUri: ${JSON.stringify(applyRe
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c27bfa4fde042f37.
Report an issue: GitHub.