{"record":{"id":"8147651a69945636","repo":"jackwener/OpenCLI","slug":"failed-to-parse-jike-post-data-data-message","errorCode":null,"errorMessage":"Failed to parse Jike post data: ${data.message || 'unknown error'}","messagePattern":"Failed to parse Jike post data: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/jike/post.js","lineNumber":68,"sourceCode":"  } catch (e) {\n    return { ok: false, reason: 'parse-error', message: e?.message || String(e) };\n  }\n})()\n`);\n        if (Array.isArray(data)) {\n            return data.map((item) => ({\n                type: item.type ?? '',\n                author: item.author ?? '',\n                content: item.content ?? '',\n                likes: item.likes ?? 0,\n                time: item.time ?? '',\n            }));\n        }\n        if (data?.reason === 'missing-data-script') {\n            throw new CommandExecutionError('Jike post page did not expose the expected data script');\n        }\n        if (data?.reason === 'parse-error') {\n            throw new CommandExecutionError(`Failed to parse Jike post data: ${data.message || 'unknown error'}`);\n        }\n        throw new CommandExecutionError('Jike post returned an unreadable payload');\n    },\n});\n","sourceCodeStart":50,"sourceCodeEnd":73,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/post.js#L50-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await cli('jike', 'post', [postUrl]).run();\n} catch (e) {\n  if (String(e.message).startsWith('Failed to parse Jike post data:')) {\n    await sleep(1000); // truncation is often transient\n    // retry once, then capture raw HTML for diagnosis\n  } else throw e;\n}","preventionTips":["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"],"tags":["parsing","scraping","json","jike"],"backgroundTag":"json-parse-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}