{"record":{"id":"4be227ca774c0810","repo":"xpzouying/xiaohongshu-mcp","slug":"feed-s-not-found-in-notedetailmap","errorCode":null,"errorMessage":"feed %s not found in noteDetailMap","messagePattern":"feed (.+?) not found in noteDetailMap","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/feed_detail.go","lineNumber":994,"sourceCode":"\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)\n\t}\n\n\treturn &FeedDetailResponse{\n\t\tNote:     noteDetail.Note,\n\t\tComments: noteDetail.Comments,\n\t}, nil\n}\n\nfunc makeFeedDetailURL(feedID, xsecToken string) string {\n\treturn fmt.Sprintf(\"https://www.xiaohongshu.com/explore/%s?xsec_token=%s&xsec_source=pc_feed\", feedID, xsecToken)\n}\n","sourceCodeStart":976,"sourceCodeEnd":1006,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/feed_detail.go#L976-L1006","documentation":"The unmarshaled noteDetailMap does not contain an entry for the requested feedID, so extractFeedDetail throws 'feed %s not found in noteDetailMap'. The page loaded but its initial state has no data for this note.","triggerScenarios":"Requesting a note ID that was deleted/blocked (state present but empty), a typo'd or stale feed ID, or key mismatch because the map is keyed by a different ID form.","commonSituations":"Using cached feed IDs from an old crawl; note removed between listing and detail fetch; xiaohongshu keying the map under a differently-formatted ID (e.g. with xsec_token).","solutions":["Verify the feedID matches exactly how it appears in the page's noteDetailMap keys (log available keys)","Refresh the feed ID from a current feeds list","Check whether the note is deleted/blocked in a browser"],"exampleFix":"// before\nreturn nil, fmt.Errorf(\"feed %s not found in noteDetailMap\", feedID)\n// after — debug aid\nkeys := make([]string, 0, len(noteDetailMap)); for k := range noteDetailMap { keys = append(keys, k) }\nreturn nil, fmt.Errorf(\"feed %s not found in noteDetailMap (keys: %v)\", feedID, keys)","handlingStrategy":"validation","validationCode":"// pre-validate the ID format before calling\nif feedID == \"\" || len(feedID) < 16 {\n    return fmt.Errorf(\"invalid feedID %q\", feedID)\n}","typeGuard":null,"tryCatchPattern":"detail, err := client.GetFeedDetailWithConfig(ctx, feedID, cfg)\nif err != nil && strings.Contains(err.Error(), \"not found in noteDetailMap\") {\n    log.Warnf(\"stale/missing feed %s\", feedID)\n    return nil // skip\n}","preventionTips":["Use freshly scraped feed IDs, not cached ones","Confirm ID matches the exact key form used on the page (watch for xsec_token variants)","Check note availability in a browser for recurring misses"],"tags":["xiaohongshu","scraping","missing-data"],"backgroundTag":"feed-not-found","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"}