{"record":{"id":"9631f3fcc8e0574a","repo":"lyswhut/lx-music-desktop","slug":"error-9631f3","errorCode":null,"errorMessage":"获取回复评论失败","messagePattern":"获取回复评论失败","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderer/utils/musicSdk/kg/comment.js","lineNumber":60,"sourceCode":"    if (statusCode != 200 || body.err_code !== 0) throw new Error('获取热门评论失败')\n    const total = body.count ?? 0\n    return { source: 'kg', comments: this.filterComment(body.list || []), total, page, limit, maxPage: Math.ceil(total / limit) || 1 }\n  },\n  async getReplyComment({ songmid, audioId }, replyId, page = 1, limit = 100) {\n    if (this._requestObj2) this._requestObj2.cancelHttp()\n\n    songmid = songmid.length == 32 // 修复歌曲ID存储变更导致图片获取失败的问题\n      ? audioId.split('_')[0]\n      : songmid\n\n    const _requestObj2 = httpFetch(`http://comment.service.kugou.com/index.php?r=commentsv2/getReplyWithLike&code=fc4be23b4e972707f36b8a828a93ba8a&p=${page}&pagesize=${limit}&ver=1.01&clientver=8373&kugouid=687373022&need_show_image=1&appid=1001&childrenid=${songmid}&tid=${replyId}`, {\n      headers: {\n        'User-Agent': 'Android712-AndroidPhone-8983-18-0-COMMENT-wifi',\n      },\n    })\n    const { body, statusCode } = await _requestObj2.promise\n    // console.log(body)\n    if (statusCode != 200 || body.err_code !== 0) throw new Error('获取回复评论失败')\n    return { source: 'kg', comments: this.filterComment(body.list || []) }\n  },\n  replaceAt(raw, atList) {\n    atList.forEach((atobj) => {\n      raw = raw.replaceAll(`[at=${atobj.id}]`, `@${atobj.name} `)\n    })\n    return raw\n  },\n  filterComment(rawList) {\n    return rawList.map(item => {\n      let data = {\n        id: item.id,\n        text: decodeName((item.atlist ? this.replaceAt(item.content, item.atlist) : item.content) || ''),\n        images: item.images ? item.images.map(i => i.url) : [],\n        location: item.location,\n        time: item.addtime,\n        timeStr: dateFormat2(new Date(item.addtime).getTime()),\n        userName: item.user_name,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/lyswhut/lx-music-desktop/blob/9c364b482e5621a1d38b50e8610d2fb974457e6e/src/renderer/utils/musicSdk/kg/comment.js#L42-L78","documentation":"Kugou reply-thread comment fetcher in kg/comment.js:60. Hits comment.service.kugou.com /index.php?r=commentsv2/getReplyWithLike with an Android COMMENT UA. Requires HTTP 200 and body.err_code === 0; otherwise throws '获取回复评论失败' (failed to fetch reply comments). Notably, songmid is remapped (audioId.split('_')[0]) when its length is 32 to work around a KG id-storage change.","triggerScenarios":"Non-200 or err_code != 0; the 32-char songmid remap produces an invalid childrenid; the replyId points at a deleted/hidden thread; the hardcoded Android COMMENT UA is blocked; signature drift on the `code` param.","commonSituations":"The reply thread was removed by Kugou; a stale replyId cached client-side; the songmid remap logic mismatches KG's current id format; rate-limiting.","solutions":["Verify the 32-char songmid remap (audioId.split('_')[0]) still matches KG's current childrenid format.","Confirm the replyId is still valid (re-fetch the parent comment if stale).","Treat a missing-thread err_code as an empty list instead of throwing.","Retry with backoff and degrade to 'no replies' in the UI."],"exampleFix":"// before\n    if (statusCode != 200 || body.err_code !== 0) throw new Error('获取回复评论失败')\n\n// after - include diagnostics\n    if (statusCode != 200 || body.err_code !== 0) {\n      throw new Error(`获取回复评论失败 (status=${statusCode}, err_code=${body?.err_code}, tid=${replyId})`)\n    }","handlingStrategy":"fallback","validationCode":"// validate replyId and remapped songmid before calling\nconst validReplyTarget = ({ songmid, audioId }, replyId) =>\n  typeof replyId === 'string' && replyId !== '' &&\n  (songmid == null || typeof songmid === 'string') &&\n  (audioId == null || typeof audioId === 'string')","typeGuard":"const isReplyThreadRef = (ref) =>\n  ref != null && typeof ref === 'object' &&\n  (typeof ref.songmid === 'string' || ref.songmid == null) &&\n  typeof ref.replyId !== 'undefined'","tryCatchPattern":"async function loadKgReplies(ref, replyId, page, limit) {\n  try {\n    return await kgComment.getReplyComment(ref, replyId, page, limit)\n  } catch (e) {\n    return { source: 'kg', comments: [], error: e.message } // show 'no replies' in UI\n  }\n}","preventionTips":["Verify the 32-char songmid remap (audioId.split('_')[0]) still matches KG's childrenid format.","Drop stale replyIds by re-fetching the parent comment before loading replies.","Treat a missing-thread err_code as an empty list, not an error."],"tags":["network","kugou","comments","third-party-api","reply-thread"],"backgroundTag":null,"analyzedSha":"9c364b482e5621a1d38b50e8610d2fb974457e6e","analyzedAt":"2026-08-12T15:14:48.244Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}