{"record":{"id":"be1e9e270e35f924","repo":"lyswhut/lx-music-desktop","slug":"error-be1e9e","errorCode":null,"errorMessage":"获取热搜词失败","messagePattern":"获取热搜词失败","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/renderer/utils/musicSdk/mg/hotSearch.js","lineNumber":11,"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://jadeite.migu.cn:7090/music_search/v3/search/hotword')\n    const { body, statusCode } = await _requestObj.promise\n    if (statusCode != 200 || body.code !== '000000') throw new Error('获取热搜词失败')\n    // console.log(body, statusCode)\n    return { source: 'mg', list: this.filterList(body.data.hotwords[0].hotwordList) }\n  },\n  filterList(rawList) {\n    return rawList.filter(item => item.resourceType == 'song').map(item => item.word)\n  },\n}\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/lyswhut/lx-music-desktop/blob/9c364b482e5621a1d38b50e8610d2fb974457e6e/src/renderer/utils/musicSdk/mg/hotSearch.js#L1-L19","documentation":"Thrown by Migu's hotSearch.getList when the hotword endpoint at http://jadeite.migu.cn:7090/music_search/v3/search/hotword returns non-200 or body.code !== '000000'. Notable differences: it uses a non-standard port (7090), sends no User-Agent header (unlike all other Migu calls), and uses plain HTTP. Has a retry guard (retryNum > 2) that fires first. Reads body.data.hotwords[0].hotwordList, so a structure change also causes a downstream crash even if code passes.","triggerScenarios":"The jadeite.migu.cn:7090 endpoint is firewalled or unreachable (port 7090 is commonly blocked by corporate/ISP firewalls). No User-Agent header makes some Migu gateways reject the request. Migu changes the hotwords response structure so body.data.hotwords is empty or missing.","commonSituations":"Corporate or cloud environments block non-standard ports (7090). ISP-level blocking of Migu's jadeite subdomain. Migu deprecates the hotword API. The app runs in a sandboxed Electron context that restricts non-standard ports.","solutions":["Log body and statusCode to determine if the port or the API contract is the issue.","Retry by calling getList(retryNum + 1) since it supports bounded retries.","Add a User-Agent header to match other Migu calls and avoid gateway rejection.","Fall back to another provider's hot search list if Migu is unavailable.","Test the endpoint with curl from the same network to isolate firewall vs. API issues."],"exampleFix":"// before\nconst _requestObj = httpFetch('http://jadeite.migu.cn:7090/music_search/v3/search/hotword')\nconst { body, statusCode } = await _requestObj.promise\nif (statusCode != 200 || body.code !== '000000') throw new Error('获取热搜词失败')\n\n// after\nconst _requestObj = httpFetch('http://jadeite.migu.cn:7090/music_search/v3/search/hotword', {\n  headers: { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X)' },\n})\nconst { body, statusCode } = await _requestObj.promise\nif (statusCode != 200 || !body || body.code !== '000000') {\n  console.warn('mg hotSearch failed', { statusCode, code: body?.code })\n  if (retryNum < 2) return this.getList(retryNum + 1)\n  throw new Error('获取热搜词失败')\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"function isMiguHotSearchResponse(body) {\n  return body != null && typeof body === 'object' && body.code === '000000' && body.data != null && Array.isArray(body.data.hotwords)\n}","tryCatchPattern":"try {\n  const result = await mgHotSearch.getList()\n} catch (err) {\n  if (err.message === '获取热搜词失败') {\n    console.warn('Migu hot search unavailable (check port 7090 firewall)')\n    return { source: 'mg', list: [] }\n  }\n  throw err\n}","preventionTips":["Call getList with a retryNum parameter to leverage built-in retries.","Ensure port 7090 is not firewalled in your network environment.","Add a User-Agent header to avoid gateway rejection.","Fall back to another provider's hot search if Migu is unavailable.","Test the endpoint with curl to isolate firewall vs. API issues."],"tags":["migu","hot-search","network","non-standard-port","api-contract","http"],"backgroundTag":null,"analyzedSha":"9c364b482e5621a1d38b50e8610d2fb974457e6e","analyzedAt":"2026-08-12T15:14:48.244Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}