DIYgod/RSSHub · error · Error

No post replies found. The post may not exist or the cookie

Error message

No post replies found. The post may not exist or the cookie is invalid.

What it means

The Tieba post route loads the post HTML, parses with cheerio, and selects '.virtual-list-item' (the Vue-rendered reply list). If that selector matches nothing it throws, indicating the post does not exist, is deleted, or the page was served without reply content (e.g. anti-bot page returned instead of the real HTML).

Source

Thrown at lib/routes/baidu/tieba/post.tsx:76

    ],
    name: '帖子动态',
    maintainers: ['u3u', 'FlanChanXwO'],
    handler,
};

async function handler(ctx) {
    const id = ctx.req.param('id');
    const lz = ctx.req.path.includes('lz') ? 1 : 0;
    const html = await getPost(id, lz);
    const $ = load(html);

    const title = $('.pb-title-wrap .pb-title').text().trim();

    // 使用新的 Vue 渲染页面选择器 - 只选择 virtual-list-item 避免重复
    const list = $('.virtual-list-item');

    if (list.length === 0) {
        throw new Error('No post replies found. The post may not exist or the cookie is invalid.');
    }

    return {
        title: lz ? `【只看楼主】${title}` : title,
        link: `https://tieba.baidu.com/p/${id}?see_lz=${lz}`,
        description: `${title}的最新回复`,
        item: list
            .toArray()
            .map((element) => {
                const item = $(element);

                // 作者名
                const authorName = item.find('.head-name').text().trim();

                // 跳过无效用户(无作者名的条目)
                if (!authorName) {
                    return null;
                }

View on GitHub (pinned to bed535e087)

Solutions

  1. Refresh BAIDU_COOKIE and retry.
  2. Open https://tieba.baidu.com/p/<id> in a browser (logged in) to confirm the post exists and renders replies.
  3. If Baidu renamed the CSS class, update the selector at lib/routes/baidu/tieba/post.tsx:69.

Example fix

// before
const list = $('.virtual-list-item');
// after (selector renamed upstream)
const list = $('.reply-list-item');
Defensive patterns

Strategy: validation

Validate before calling

function postHasReplies($: ReturnType<typeof load>): boolean {
  return $('.virtual-list-item').length > 0;
}
if (!postHasReplies($)) throw new Error('Post has no replies or cookie invalid');

Type guard

const postLooksRendered = ($: ReturnType<typeof load>): boolean =>
  $('.virtual-list-item').length > 0 || $('.pb-title-wrap .pb-title').length > 0;

Try / catch

try {
  return await handler(ctx);
} catch (e) {
  if (e instanceof Error && /No post replies found/.test(e.message)) {
    ctx.throw(404, 'Post not found or cookie invalid');
  }
  throw e;
}

Prevention

When it happens

Trigger: getPost returns HTML that contains zero '.virtual-list-item' elements - typically because the post ID is invalid/deleted, or because the request was redirected to a login/captcha page that lacks the Vue reply list.

Common situations: Stale or invalid BAIDU_COOKIE causing the post page to render without replies; post ID typo; the post was removed by Baidu; Tieba changed the reply list CSS class from 'virtual-list-item' to something else.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/7af3a6e5748ddc3a. Report an issue: GitHub.