xpzouying/xiaohongshu-mcp · error

未找到通知条目: %w

Error message

未找到通知条目: %w

What it means

After locating the comment, Reply queries the notification page DOM for items matching `.tabs-content-container > .container`. If rod cannot find any such elements it wraps the rod error with this message. This means the notification page loaded but its item list did not render in the expected structure.

Source

Thrown at xiaohongshu/notification_reply.go:43

		return nil, fmt.Errorf("缺少 comment_id")
	}
	if strings.TrimSpace(content) == "" {
		return nil, fmt.Errorf("回复内容不能为空")
	}

	page := n.page.Timeout(3 * time.Minute)

	page.MustNavigate("https://www.xiaohongshu.com/notification").MustWaitLoad()
	humanize.Delay(ctx, humanize.AfterNavigate)

	target, index, err := n.locate(ctx, page, commentID)
	if err != nil {
		return nil, err
	}

	items, err := page.Elements(`.tabs-content-container > .container`)
	if err != nil {
		return nil, fmt.Errorf("未找到通知条目: %w", err)
	}
	if index >= len(items) {
		return nil, fmt.Errorf("通知条目渲染数(%d)少于目标位置(%d),页面可能未加载完", len(items), index)
	}
	item := items[index]

	humanize.Delay(ctx, humanize.Reading)

	replyBtn, err := item.Element(`.action-reply`)
	if err != nil {
		return nil, fmt.Errorf("该通知没有回复入口(评论可能已删除或不可回复): %w", err)
	}

	humanize.Delay(ctx, humanize.BeforeClick)
	if err := humanize.Click(replyBtn); err != nil {
		return nil, fmt.Errorf("无法点击回复: %w", err)
	}
	humanize.Delay(ctx, humanize.AfterClick)

View on GitHub (pinned to 332d196854)

Solutions

  1. Ensure the browser session/cookies are valid and logged in to xiaohongshu.com
  2. Retry the call — the page may not have finished rendering
  3. Check whether Xiaohongshu changed the `.tabs-content-container > .container` selectors and update the library
  4. Increase page timeout or add explicit wait before querying elements
Defensive patterns

Strategy: retry

Validate before calling

// no pre-call validation possible; verify session first
hasLogin := checkLoginPage(browser) // ensure not on a login wall

Try / catch

res, err := n.Reply(ctx, commentID, content)
if err != nil && strings.Contains(err.Error(), "未找到通知条目") {
    time.Sleep(2 * time.Second)
    res, err = n.Reply(ctx, commentID, content) // retry once
}

Prevention

When it happens

Trigger: page.Elements('.tabs-content-container > .container') returns an error during Reply, typically because the notification page DOM differs from expectations (login wall, redesign, slow render).

Common situations: Session cookie expired so a login page rendered instead; Xiaohongshu changed frontend CSS class names; network slowness left the tab content unrendered.

Related errors


AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05). Data as JSON: /api/errors/b2cfa83297c307a7. Report an issue: GitHub.