jackwener/OpenCLI · warning · EmptyResultError

bilibili comment replies: ${parent}

Error message

bilibili comment replies: ${parent}

What it means

An EmptyResultError thrown when querying with --parent <rpid>: the /x/v2/reply/reply endpoint returned zero nested replies, meaning the given parent comment has no sub-replies (楼中楼).

Source

Thrown at clis/bilibili/comments.js:156

            throw new CommandExecutionError(`Cannot resolve aid for bvid: ${bvid}`);
        const payload = parent != null
            ? await apiGet(page, '/x/v2/reply/reply', {
                params: { oid: aid, type: 1, root: parent, pn: 1, ps: limit },
            })
            : await apiGet(page, '/x/v2/reply/main', {
                params: { oid: aid, type: 1, mode: 3, ps: top ? 1 : limit },
                signed: true,
            });
        const label = parent != null ? 'reply thread' : 'reply main';
        const data = requireOkPayload(payload, label);
        const replies = top
            ? requireTopReplies(data, label)
            : requireReplies(data, label);
        if (replies.length === 0) {
            if (top) {
                throw new EmptyResultError(`bilibili pinned comments: ${bvid}`);
            }
            throw new EmptyResultError(parent != null ? `bilibili comment replies: ${parent}` : `bilibili comments: ${bvid}`);
        }
        return replies.slice(0, limit).map(formatReplyRow);
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the rpid belongs to a comment that actually has replies (check the replies column of the top-level listing)
  2. Omit --parent to browse top-level comments instead
  3. Treat this EmptyResultError as a benign 'no replies' outcome in automation
  4. Re-fetch top-level comments to confirm the rpid is still valid
Defensive patterns

Strategy: try-catch

Validate before calling

const parentRow = topRows.find((r) => String(r.rpid) === String(parent));
if (parentRow && Number(parentRow.replies) === 0) {
    console.warn('parent comment has no nested replies; skipping --parent query');
}

Type guard

function hasReplies(row) {
    return !!row && Number(row.replies) > 0;
}

Try / catch

try {
    const nested = await bilibiliComments(bvid, { parent });
} catch (err) {
    if (err instanceof EmptyResultError || /comment replies/.test(err.message)) {
        // treat as zero replies, not a failure
    } else throw err;
}

Prevention

When it happens

Trigger: Running 'bilibili comments <bvid> --parent <rpid>' where the parent comment's reply list is empty (replies: [] or null), typically because the root comment has no replies or the rpid points at a comment whose replies were removed.

Common situations: Reusing an rpid captured earlier after its replies were deleted; passing a valid but reply-less comment ID; pagination stopping at page 1 of an empty thread.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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