jackwener/OpenCLI · error · CommandExecutionError
Failed to parse Jike post data: ${data.message || 'unknown e
Error message
Failed to parse Jike post data: ${data.message || 'unknown error'} What it means
When the loader finds the Jike post's embedded data script but JSON.parse (or equivalent extraction) throws, it reports reason 'parse-error' with the underlying message, and the CLI wraps it in CommandExecutionError with that message.
Source
Thrown at clis/jike/post.js:68
} catch (e) {
return { ok: false, reason: 'parse-error', message: e?.message || String(e) };
}
})()
`);
if (Array.isArray(data)) {
return data.map((item) => ({
type: item.type ?? '',
author: item.author ?? '',
content: item.content ?? '',
likes: item.likes ?? 0,
time: item.time ?? '',
}));
}
if (data?.reason === 'missing-data-script') {
throw new CommandExecutionError('Jike post page did not expose the expected data script');
}
if (data?.reason === 'parse-error') {
throw new CommandExecutionError(`Failed to parse Jike post data: ${data.message || 'unknown error'}`);
}
throw new CommandExecutionError('Jike post returned an unreadable payload');
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Save the raw HTML and inspect the script content around the parse error position
- Retry — truncation is often transient (network/CDN)
- Update the CLI for a more tolerant parser if Jike changed serialization
- Bypass proxies/VPN that might alter the response body
Defensive patterns
Strategy: retry
Try / catch
try {
await cli('jike', 'post', [postUrl]).run();
} catch (e) {
if (String(e.message).startsWith('Failed to parse Jike post data:')) {
await sleep(1000); // truncation is often transient
// retry once, then capture raw HTML for diagnosis
} else throw e;
} Prevention
- Retry on first failure — truncation is usually transient
- Avoid unreliable proxies/VPN that alter response bodies
- Pin a CLI version whose parser matches the current Jike serialization
When it happens
Trigger: The embedded data script exists but its content is not valid JSON or not parseable by the extraction logic — truncated HTML, escaped-character issues, script content served as JSON5 or JS rather than pure JSON.
Common situations: Proxy/CDN truncating the HTML response; Jike changing the script's serialization format; character-encoding issues (non-UTF8 responses); anti-bot rewrites mangling the payload.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse Jike topic data: ${data.message || 'unknown
- ${label} returned invalid JSON: ${outcome.detail}
- archive search returned malformed JSON: ${error?.message ||
- archive wayback returned malformed JSON: ${error?.message ||
- Barchart greeks returned an unreadable options payload${data
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/8147651a69945636.
Report an issue: GitHub.