{"record":{"id":"9d2892f7eddf1c30","repo":"jackwener/OpenCLI","slug":"bilibili-reply-add-api-did-not-return-rpid-for-the","errorCode":null,"errorMessage":"Bilibili reply add API did not return rpid for the posted comment","messagePattern":"Bilibili reply add API did not return rpid for the posted comment","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/bilibili/comment.js","lineNumber":97,"sourceCode":"        // For a reply, Bilibili needs both `root` (top-level comment) and `parent`.\n        // Replying to a top-level comment means root === parent.\n        const params = {\n            oid,\n            type: 1,\n            message,\n            plat: 1,\n            ...(parent != null\n                ? { root: parent, parent }\n                : {}),\n            ...(Object.keys(atNameToMid).length > 0\n                ? { at_name_to_mid: JSON.stringify(atNameToMid) }\n                : {}),\n        };\n        const payload = await apiPost(page, '/x/v2/reply/add', { params });\n        const postData = requireOkPayload(payload, 'reply add');\n        const rpid = postData?.rpid;\n        if (!rpid) {\n            throw new CommandExecutionError('Bilibili reply add API did not return rpid for the posted comment');\n        }\n        return [{\n            rpid: String(rpid),\n            bvid,\n            oid: String(oid),\n            message,\n            url: `https://www.bilibili.com/video/${bvid}#reply${rpid}`,\n        }];\n    },\n});\n","sourceCodeStart":79,"sourceCodeEnd":108,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/bilibili/comment.js#L79-L108","documentation":"After POSTing to /x/v2/reply/add and requireOkPayload succeeds, the CLI expects the payload to contain `rpid` (the new comment's reply id) used to build the result row. A missing rpid means the API claimed success but did not identify the created comment, so the library throws CommandExecutionError.","triggerScenarios":"Bilibili's reply add endpoint returns code 0 but rpid absent/0 — schema drift, shadow-banned/filtered comments where the post is silently not created, or anti-bot interstitials returning deceptively ok payloads.","commonSituations":"Comment posted but immediately held by moderation filter; Bilibili API response shape changed; account restricted from commenting (muted) yet API returns success without rpid.","solutions":["Check the comment actually appeared on the video page; if not, the account may be muted/filtered","Log/inspect the raw reply add payload to see what was returned","Retry later if it was transient; verify against Bilibili API docs for schema changes","Verify the account is in good standing (not rate-limited or shadow-banned)"],"exampleFix":"// before\nconst rpid = postData?.rpid;\n// after\nconst rpid = postData?.rpid ?? postData?.reply?.rpid;\nif (!rpid) console.error('reply add payload:', JSON.stringify(postData));","handlingStrategy":"validation","validationCode":null,"typeGuard":"const hasRpid = (d) => d != null && d.rpid != null && Number(d.rpid) !== 0;","tryCatchPattern":"try { await commentCmd(); } catch (e) { if (String(e.message).includes('did not return rpid')) { console.error('Check the video page / account status; post may have been filtered'); } else throw e; }","preventionTips":["Log raw reply-add payloads for post-mortem","Check the comment actually appears on the page before considering it posted","Watch account standing (mutes/filters) in automation","Track Bilibili API schema updates"],"tags":["api","schema-change","write-operation"],"backgroundTag":"api-response-missing-field","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}