lyswhut/lx-music-desktop · warning · Error

获取热搜词失败

Error message

获取热搜词失败

What it means

Thrown by QQ Music's hotSearch.getList when the musicu.fcg endpoint at https://u.y.qq.com/cgi-bin/musicu.fcg returns non-200 or body.code !== 0. Uses POST with a JSON body (module: tencent_musicsoso_hotkey.HotkeyService, method: GetHotkeyForQQMusicPC). Has a retry guard (retryNum > 2) that fires first. Only checks body.code (not a nested req.code), unlike error 51 which uses the same endpoint. Reads body.hotkey.data.vec_hotkey.

Source

Thrown at src/renderer/utils/musicSdk/tx/hotSearch.js:47

          uin: '0',
          wid: '0',
        },
        hotkey: {
          method: 'GetHotkeyForQQMusicPC',
          module: 'tencent_musicsoso_hotkey.HotkeyService',
          param: {
            search_id: '',
            uin: 0,
          },
        },
      },
      headers: {
        Referer: 'https://y.qq.com/portal/player.html',
      },
    })
    const { body, statusCode } = await _requestObj.promise
    // console.log(body)
    if (statusCode != 200 || body.code !== 0) throw new Error('获取热搜词失败')
    // console.log(body)
    return { source: 'tx', list: this.filterList(body.hotkey.data.vec_hotkey) }
  },
  filterList(rawList) {
    return rawList.map(item => item.query)
  },
}

View on GitHub (pinned to 9c364b482e)

Solutions

  1. Log body and statusCode to see the error code and message.
  2. Inspect current y.qq.com network requests to update the module/method/Referer strings.
  3. Retry by calling getList(retryNum + 1) since it supports bounded retries.
  4. Fall back to another provider's hot search if QQ Music is unavailable.

Example fix

// before
if (statusCode != 200 || body.code !== 0) throw new Error('获取热搜词失败')

// after
if (statusCode != 200 || !body || body.code !== 0) {
  console.warn('tx hotSearch failed', { statusCode, code: body?.code })
  if (retryNum < 2) return this.getList(retryNum + 1)
  throw new Error('获取热搜词失败')
}
Defensive patterns

Strategy: retry

Type guard

function isTxHotSearchResponse(body) {
  return body != null && typeof body === 'object' && body.code === 0 && body.hotkey != null && body.hotkey.data != null
}

Try / catch

try {
  const result = await txHotSearch.getList()
} catch (err) {
  if (err.message === '获取热搜词失败') {
    console.warn('QQ Music hot search unavailable')
    return { source: 'tx', list: [] }
  }
  throw err
}

Prevention

When it happens

Trigger: Calling getList() when Tencent changes the HotkeyService module path or method name. Anti-bot detection blocks the request. The Referer header (https://y.qq.com/portal/player.html) is outdated. body.code is non-zero for rate-limited or geo-blocked requests.

Common situations: Tencent updates its internal module/method naming between versions. The fixed Referer URL becomes stale when QQ Music's portal page changes. ISP-level interference with u.y.qq.com.

Related errors


AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12). Data as JSON: /api/errors/ece68040af68e1de. Report an issue: GitHub.