xpzouying/xiaohongshu-mcp · warning
点赞未确认成功:%s 内状态未变成 %v。点赞可能已生效但同步慢,请先用 list_notifications 读一次当
Error message
点赞未确认成功:%s 内状态未变成 %v。点赞可能已生效但同步慢,请先用 list_notifications 读一次当前状态再决定是否重试
What it means
waitLikeSettled 在 likeSettleTimeout(15s)内轮询通知数据中该评论的 liked 状态始终未变成目标值。因为无法区分「点赞实际已生效但同步慢」与「根本没点上」,所以提示先读一次当前状态再决定是否重试,避免重复点赞。
Source
Thrown at xiaohongshu/notification_like.go:90
return nil, fmt.Errorf("无法点击点赞: %w", err)
}
if err := n.waitLikeSettled(page, commentID, want); err != nil {
return nil, err
}
humanize.Delay(ctx, humanize.AfterInteract)
logrus.Infof("通知点赞成功: comment=%s liked=%v", commentID, want)
return result, nil
}
// waitLikeSettled 等待点赞状态变成目标值;判不出来直接报错,不自动重试。
func (n *NotificationAction) waitLikeSettled(page *rod.Page, commentID string, want bool) error {
if n.likedMatches(page, commentID, want, likeSettleTimeout) {
return nil
}
return fmt.Errorf("点赞未确认成功:%s 内状态未变成 %v。点赞可能已生效但同步慢,"+
"请先用 list_notifications 读一次当前状态再决定是否重试", likeSettleTimeout, want)
}
// likedMatches 轮询状态,直到目标评论的 liked 等于 want 或超时。
func (n *NotificationAction) likedMatches(page *rod.Page, commentID string, want bool, timeout time.Duration) bool {
deadline := time.Now().Add(timeout)
for time.Now().Before(deadline) {
payload, err := n.readTab(page, TabMentions)
if err == nil {
for _, r := range payload.MessageList {
if r.Comment.ID == commentID {
if r.Comment.Liked == want {
return true
}
break
}
}
}View on GitHub (pinned to 332d196854)
Solutions
- 按错误提示先调用 list_notifications 读取当前 liked 状态再决定是否重试
- 延长 settle 超时(如通过更长的等待窗口)后重试一次
- 若多次未确认成功,停止重试,人工检查是否触发风控
- 在页面上刷新或重新导航后再次轮询状态
Example fix
// before
if err := n.waitLikeSettled(page, commentID, want); err != nil { return nil, err }
// after
if err := n.waitLikeSettled(page, commentID, want); err != nil {
result, listErr := n.List(ctx, "like")
if listErr == nil && notificationHasLiked(result, commentID, want) {
return likeResult, nil // 实际已生效
}
return nil, err
} Defensive patterns
Strategy: validation
Validate before calling
// 超时后先读当前状态再决定是否重试
items, err := n.List(ctx)
if err != nil { return err }
for _, it := range items {
if it.CommentID == commentID && it.Liked == want { return nil /* 已生效,勿重试 */ }
} Try / catch
_, err := n.Like(ctx, commentID, false)
if err != nil && strings.Contains(err.Error(), "点赞未确认成功") {
if !currentStateMatches(ctx, n, commentID, want) {
time.Sleep(5 * time.Second)
_, err = n.Like(ctx, commentID, want) // 确认未生效才重试
}
} Prevention
- 重试前必须先读当前 liked 状态,避免重复点赞
- 控制操作频率,避免触发风控静默失败
- 接受点赞可能延迟生效,超时不宜过短
- 建立人工复核通道处理多次未确认的情况
When it happens
Trigger: Like 点击后调用 waitLikeSettled 超时:服务端同步延迟、点击实际未生效(被风控拦截)、页面状态未刷新导致 likedMatches 读到旧值。
Common situations: 小红书点赞接口延迟高;高频自动化操作触发风控静默失败;页面状态缓存导致轮询一直读旧数据。
Related errors
- read current user state failed
- 读取通知列表失败: %w
- 页面状态里没有分区 %s,可能未登录或页面结构已变化
- 未找到通知条目: %w
- 通知条目渲染数(%d)少于目标位置(%d),页面可能未加载完
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/b0fa82ef7bcb011f.
Report an issue: GitHub.