jackwener/OpenCLI · error · CommandExecutionError

Bilibili reply add API did not return rpid for the posted co

Error message

Bilibili reply add API did not return rpid for the posted comment

What it means

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.

Source

Thrown at clis/bilibili/comment.js:97

        // For a reply, Bilibili needs both `root` (top-level comment) and `parent`.
        // Replying to a top-level comment means root === parent.
        const params = {
            oid,
            type: 1,
            message,
            plat: 1,
            ...(parent != null
                ? { root: parent, parent }
                : {}),
            ...(Object.keys(atNameToMid).length > 0
                ? { at_name_to_mid: JSON.stringify(atNameToMid) }
                : {}),
        };
        const payload = await apiPost(page, '/x/v2/reply/add', { params });
        const postData = requireOkPayload(payload, 'reply add');
        const rpid = postData?.rpid;
        if (!rpid) {
            throw new CommandExecutionError('Bilibili reply add API did not return rpid for the posted comment');
        }
        return [{
            rpid: String(rpid),
            bvid,
            oid: String(oid),
            message,
            url: `https://www.bilibili.com/video/${bvid}#reply${rpid}`,
        }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check the comment actually appeared on the video page; if not, the account may be muted/filtered
  2. Log/inspect the raw reply add payload to see what was returned
  3. Retry later if it was transient; verify against Bilibili API docs for schema changes
  4. Verify the account is in good standing (not rate-limited or shadow-banned)

Example fix

// before
const rpid = postData?.rpid;
// after
const rpid = postData?.rpid ?? postData?.reply?.rpid;
if (!rpid) console.error('reply add payload:', JSON.stringify(postData));
Defensive patterns

Strategy: validation

Type guard

const hasRpid = (d) => d != null && d.rpid != null && Number(d.rpid) !== 0;

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: Comment posted but immediately held by moderation filter; Bilibili API response shape changed; account restricted from commenting (muted) yet API returns success without rpid.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/9d2892f7eddf1c30. Report an issue: GitHub.