xpzouying/xiaohongshu-mcp · error
提取Feed详情失败: %w
Error message
提取Feed详情失败: %w
What it means
extractFeedDetail wraps any failure from the retried extraction (JS evaluation, retries exhausted) into '提取Feed详情失败: %w'. The caller GetFeedDetailWithConfig receives this aggregated error after 3 failed attempts.
Source
Thrown at xiaohongshu/feed_detail.go:976
}`).String()
if evalResult != "" {
result = evalResult
return nil
}
return fmt.Errorf("无法获取初始状态数据")
},
retry.Attempts(3),
retry.Delay(200*time.Millisecond),
retry.MaxJitter(300*time.Millisecond),
retry.OnRetry(func(n uint, err error) {
logrus.Debugf("提取Feed详情重试 #%d: %v", n, err)
}),
)
if err != nil {
logrus.Errorf("提取Feed详情失败: %v", err)
return nil, fmt.Errorf("提取Feed详情失败: %w", err)
}
if result == "" {
return nil, errors.ErrNoFeedDetail
}
var noteDetailMap map[string]struct {
Note FeedDetail `json:"note"`
Comments CommentList `json:"comments"`
}
if err := json.Unmarshal([]byte(result), ¬eDetailMap); err != nil {
return nil, fmt.Errorf("failed to unmarshal noteDetailMap: %w", err)
}
noteDetail, exists := noteDetailMap[feedID]
if !exists {
return nil, fmt.Errorf("feed %s not found in noteDetailMap", feedID)View on GitHub (pinned to 332d196854)
Solutions
- Read the wrapped %w cause to determine whether it's access-blocked vs extraction failure
- Retry later or with a fresh browser context/session
- If persistent, check whether the note is accessible and whether the page structure changed
Example fix
// before
return err // opaque
// after
if errors.Is(err, errors.ErrNoFeedDetail) || strings.Contains(err.Error(), "笔记不可访问") { ... skip ... } else { log root cause via %w unwrap } Defensive patterns
Strategy: try-catch
Try / catch
detail, err := client.GetFeedDetailWithConfig(ctx, id, cfg)
if err != nil {
log.Errorf("feed %s: %v", id, err) // %w chain preserves root cause
if strings.Contains(err.Error(), "笔记不可访问") { return nil }
return err
} Prevention
- Inspect the wrapped cause with errors.As/%v before deciding to retry
- Back off between detail fetches to avoid anti-bot throttling
- Detect persistent failures per-note and stop retrying that note
When it happens
Trigger: All 3 retry attempts of the in-page extraction returned '无法获取初始状态数据' or the retry call otherwise failed (page closed, navigation error, browser timeout).
Common situations: Heavy anti-bot environment; note blocked so page never contains state; flaky proxy/network causing rod timeouts on all attempts.
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/2a4f15852aebf62d.
Report an issue: GitHub.