{"record":{"id":"2a4f15852aebf62d","repo":"xpzouying/xiaohongshu-mcp","slug":"feed-w","errorCode":null,"errorMessage":"提取Feed详情失败: %w","messagePattern":"提取Feed详情失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/feed_detail.go","lineNumber":976,"sourceCode":"\t\t\t}`).String()\n\n\t\t\tif evalResult != \"\" {\n\t\t\t\tresult = evalResult\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"无法获取初始状态数据\")\n\t\t},\n\t\tretry.Attempts(3),\n\t\tretry.Delay(200*time.Millisecond),\n\t\tretry.MaxJitter(300*time.Millisecond),\n\t\tretry.OnRetry(func(n uint, err error) {\n\t\t\tlogrus.Debugf(\"提取Feed详情重试 #%d: %v\", n, err)\n\t\t}),\n\t)\n\n\tif err != nil {\n\t\tlogrus.Errorf(\"提取Feed详情失败: %v\", err)\n\t\treturn nil, fmt.Errorf(\"提取Feed详情失败: %w\", err)\n\t}\n\n\tif result == \"\" {\n\t\treturn nil, errors.ErrNoFeedDetail\n\t}\n\n\tvar noteDetailMap map[string]struct {\n\t\tNote     FeedDetail  `json:\"note\"`\n\t\tComments CommentList `json:\"comments\"`\n\t}\n\n\tif err := json.Unmarshal([]byte(result), &noteDetailMap); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal noteDetailMap: %w\", err)\n\t}\n\n\tnoteDetail, exists := noteDetailMap[feedID]\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"feed %s not found in noteDetailMap\", feedID)","sourceCodeStart":958,"sourceCodeEnd":994,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/feed_detail.go#L958-L994","documentation":"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.","triggerScenarios":"All 3 retry attempts of the in-page extraction returned '无法获取初始状态数据' or the retry call otherwise failed (page closed, navigation error, browser timeout).","commonSituations":"Heavy anti-bot environment; note blocked so page never contains state; flaky proxy/network causing rod timeouts on all attempts.","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"],"exampleFix":"// before\nreturn err // opaque\n// after\nif errors.Is(err, errors.ErrNoFeedDetail) || strings.Contains(err.Error(), \"笔记不可访问\") { ... skip ... } else { log root cause via %w unwrap }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"detail, err := client.GetFeedDetailWithConfig(ctx, id, cfg)\nif err != nil {\n    log.Errorf(\"feed %s: %v\", id, err) // %w chain preserves root cause\n    if strings.Contains(err.Error(), \"笔记不可访问\") { return nil }\n    return err\n}","preventionTips":["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"],"tags":["xiaohongshu","scraping","retry-exhausted"],"backgroundTag":"scrape-extraction-failed","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}