{"record":{"id":"3ae97c84b9ce3b5f","repo":"jackwener/OpenCLI","slug":"jike-post-returned-an-unreadable-payload","errorCode":null,"errorMessage":"Jike post returned an unreadable payload","messagePattern":"Jike post returned an unreadable payload","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/jike/post.js","lineNumber":70,"sourceCode":"  }\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":52,"sourceCodeEnd":73,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/post.js#L52-L73","documentation":"Fallback guard in the Jike post command: if the loader returns data with neither valid post items nor a recognized reason ('missing-data-script'/'parse-error'), the CLI assumes the payload is unreadable and throws CommandExecutionError. It covers all unrecognized loader outcomes.","triggerScenarios":"The page loader returns null/undefined data, an object with an unexpected reason value, or a shape missing items — e.g. unexpected HTML layouts, redirect pages, or loader version mismatches.","commonSituations":"Jike serves a redirect or consent page the loader doesn't recognize; the CLI version predates a new loader reason value; the script parses fine but the item structure changed so mapping yields nothing.","solutions":["Dump the loader's raw `data` value to see which unrecognized shape was returned","Check the post URL in a browser for redirects or walls","Update the CLI/library to the latest version","Fall back to the authenticated Jike API for this post instead of page scraping"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":"function hasRecognizedReason(d) {\n  return d !== null && typeof d === 'object' &&\n    (d.reason === 'missing-data-script' || d.reason === 'parse-error' || Array.isArray(d.items));\n}","tryCatchPattern":"try {\n  await cli('jike', 'post', [postUrl]).run();\n} catch (e) {\n  if (String(e.message).includes('unreadable payload')) {\n    // fallback: use authenticated Jike API endpoint for this post\n  } else throw e;\n}","preventionTips":["Maintain an authenticated API fallback for scraping failures","Keep the loader and CLI versions in sync","Log unrecognized loader payloads to extend coverage of known reasons"],"tags":["scraping","fallback","jike"],"backgroundTag":"unreadable-response-payload","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}