{"record":{"id":"012df489e661b4ea","repo":"jackwener/OpenCLI","slug":"bilibili-label-api-did-not-return-replies","errorCode":null,"errorMessage":"Bilibili ${label} API did not return replies","messagePattern":"Bilibili (.+?) API did not return replies","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/bilibili/comments.js","lineNumber":55,"sourceCode":"    if (!payload || typeof payload !== 'object' || Array.isArray(payload) || !Object.hasOwn(payload, 'code')) {\n        throw new CommandExecutionError(`Bilibili ${label} API returned a malformed payload`);\n    }\n    if (payload.code !== 0) {\n        const message = payload.message ?? 'unknown error';\n        if (isAuthLikeBilibiliError(payload.code, message)) {\n            throw new AuthRequiredError('bilibili.com', `Bilibili ${label} API requires login or permission: ${message} (${payload.code})`);\n        }\n        throw new CommandExecutionError(`Bilibili ${label} API failed: ${message} (${payload.code})`);\n    }\n    return payload.data;\n}\n\nfunction requireReplies(data, label) {\n    if (!data || typeof data !== 'object' || Array.isArray(data)) {\n        throw new CommandExecutionError(`Bilibili ${label} API returned malformed data`);\n    }\n    if (!Object.hasOwn(data, 'replies')) {\n        throw new CommandExecutionError(`Bilibili ${label} API did not return replies`);\n    }\n    if (data.replies === null) {\n        return [];\n    }\n    if (!Array.isArray(data.replies)) {\n        throw new CommandExecutionError(`Bilibili ${label} API returned malformed replies`);\n    }\n    return data.replies;\n}\n\nfunction requireTopReplies(data, label) {\n    if (!data || typeof data !== 'object' || Array.isArray(data)) {\n        throw new CommandExecutionError(`Bilibili ${label} API returned malformed data`);\n    }\n    if (!Object.hasOwn(data, 'top_replies')) {\n        throw new CommandExecutionError(`Bilibili ${label} API did not return top_replies`);\n    }\n    if (!Array.isArray(data.top_replies)) {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/bilibili/comments.js#L37-L73","documentation":"CommandExecutionError thrown by requireReplies when the successful reply payload's data object has no `replies` property at all. Bilibili normally includes `replies` (possibly null when there are no comments), so a missing key means an unexpected response shape.","triggerScenarios":"API code===0 but data lacks `replies` — e.g. the reply/main endpoint returned a cursor/object of a different shape, or a degraded/risk-control response.","commonSituations":"Bilibili A/B-testing new response formats; interception by anti-bot returning success with truncated data; using a stale library against a changed API.","solutions":["Retry; check for videos with zero comments (should yield replies: null, not a missing key — if you see this consistently, the shape changed)","Update the CLI library to a version matching the current Bilibili API","Capture the raw response for a bug report"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"null","typeGuard":"function hasReplies(d) { return !!d && typeof d === 'object' && !Array.isArray(d) && Object.hasOwn(d, 'replies'); }","tryCatchPattern":"try { const rows = await run(['bilibili','comments',bvid]); } catch (e) { if (/did not return replies/.test(e.message)) return retryWithBackoff(fn, 2); throw e; }","preventionTips":["Treat missing replies as a signal to re-fetch or degrade gracefully","Monitor for Bilibili A/B response-shape changes","Update the library if the shape change is permanent"],"tags":["api-response","schema-validation","upstream-error"],"backgroundTag":"api-malformed-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}