jackwener/OpenCLI · warning · EmptyResultError
bilibili pinned comments: ${bvid}
Error message
bilibili pinned comments: ${bvid} What it means
An EmptyResultError thrown when --top was requested but the reply-main API returned an empty top_replies array — the video has no pinned comment, so there is nothing to show.
Source
Thrown at clis/bilibili/comments.js:154
const aid = viewData?.aid;
if (!aid)
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
- Run without --top to list normal comments instead
- Handle EmptyResultError as a benign 'no pinned comment' outcome in scripts
- Pick a different video if the pinned comment specifically is required
Defensive patterns
Strategy: try-catch
Try / catch
try {
const pinned = await bilibiliComments(bvid, { top: true });
} catch (err) {
if (err instanceof EmptyResultError || /pinned comments/.test(err.message)) {
const all = await bilibiliComments(bvid); // fall back to normal comments
} else throw err;
} Prevention
- Treat EmptyResultError for --top as expected for most videos
- Fall back to normal comments when no pin exists
- Avoid assuming every video has a pinned comment in batch jobs
- Check a video's page in the browser to confirm a pin exists first
When it happens
Trigger: Running 'bilibili comments <bvid> --top' on a video where the uploader/moderator has not pinned any comment (top_replies: [] after requireTopReplies).
Common situations: Most videos simply have no pinned comment; scripting a batch over videos assuming each has one; checking a freshly uploaded video before the author pinned anything.
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
- bilibili comment replies: ${parent}
- bilibili creator-stats ${bvid}
- 此视频没有发现外挂或智能字幕。
- 字幕文件中没有字幕片段。
- Bilibili has not generated an AI summary for ${bvid}.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2571b24007b2e4bb.
Report an issue: GitHub.