{"record":{"id":"059c597dfa58e5e8","repo":"lyswhut/lx-music-desktop","slug":"error-059c59","errorCode":null,"errorMessage":"获取热搜词失败","messagePattern":"获取热搜词失败","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/renderer/utils/musicSdk/kw/hotSearch.js","lineNumber":15,"sourceCode":"import { httpFetch } from '../../request'\n\nexport default {\n  _requestObj: null,\n  async getList(retryNum = 0) {\n    if (this._requestObj) this._requestObj.cancelHttp()\n    if (retryNum > 2) return Promise.reject(new Error('try max num'))\n\n    const _requestObj = httpFetch('http://hotword.kuwo.cn/hotword.s?prod=kwplayer_ar_9.3.0.1&corp=kuwo&newver=2&vipver=9.3.0.1&source=kwplayer_ar_9.3.0.1_40.apk&p2p=1&notrace=0&uid=0&plat=kwplayer_ar&rformat=json&encoding=utf8&tabid=1', {\n      headers: {\n        'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9;)',\n      },\n    })\n    const { body, statusCode } = await _requestObj.promise\n    if (statusCode != 200 || body.status !== 'ok') throw new Error('获取热搜词失败')\n    // console.log(body, statusCode)\n    return { source: 'kw', list: this.filterList(body.tagvalue) }\n  },\n  filterList(rawList) {\n    return rawList.map(item => item.key)\n  },\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/lyswhut/lx-music-desktop/blob/9c364b482e5621a1d38b50e8610d2fb974457e6e/src/renderer/utils/musicSdk/kw/hotSearch.js#L1-L23","documentation":"Thrown by Kuwo's hotSearch.getList when the hot search word endpoint at http://hotword.kuwo.cn/hotword.s returns a non-200 HTTP status or body.status is not strictly 'ok'. This is the only error among the group that uses strict equality (!==) for the status field check, and it checks a different field name (body.status instead of body.code). Has a retry guard (retryNum > 2) that fires first.","triggerScenarios":"Calling getList() when hotword.kuwo.cn is unreachable or returns an error status. The endpoint has no query parameters besides fixed app-version strings, so Kuwo deprecating or changing the response format (body.status no longer 'ok') triggers this. The retryNum guard fires before this throw if getList has already been retried 3 times.","commonSituations":"Kuwo sunsets the hotword.s endpoint or changes the prod/version query params. ISP blocks hotword.kuwo.cn. The app runs in a region where Kuwo is geo-blocked.","solutions":["Log body and statusCode before the throw to see if the issue is transport or contract.","Update the prod/source version query parameters to match the latest Kuwo APK.","Retry by calling getList(retryNum + 1) since it supports bounded retries.","Fall back to another provider's hot search if Kuwo remains unavailable."],"exampleFix":"// before\nif (statusCode != 200 || body.status !== 'ok') throw new Error('获取热搜词失败')\n\n// after\nif (statusCode != 200 || !body || body.status !== 'ok') {\n  console.warn('kw hotSearch failed', { statusCode, status: body?.status })\n  if (retryNum < 2) return this.getList(retryNum + 1)\n  throw new Error('获取热搜词失败')\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"function isKwHotSearchResponse(body) {\n  return body != null && typeof body === 'object' && body.status === 'ok' && Array.isArray(body.tagvalue)\n}","tryCatchPattern":"try {\n  const result = await kwHotSearch.getList()\n} catch (err) {\n  if (err.message === '获取热搜词失败') {\n    console.warn('Kuwo hot search unavailable, falling back')\n    return { source: 'kw', list: [] }\n  }\n  throw err\n}","preventionTips":["Call getList with a retryNum parameter to leverage the built-in retry mechanism.","Fall back to another provider's hot search if Kuwo fails.","Keep the prod/version query parameters updated to match the latest Kuwo APK.","Log body.status to detect contract changes."],"tags":["kuwo","hot-search","network","api-contract","retry"],"backgroundTag":null,"analyzedSha":"9c364b482e5621a1d38b50e8610d2fb974457e6e","analyzedAt":"2026-08-12T15:14:48.244Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}