lyswhut/lx-music-desktop · warning · Error
获取热搜词失败
Error message
获取热搜词失败
What it means
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.
Source
Thrown at src/renderer/utils/musicSdk/mg/hotSearch.js:11
import { httpFetch } from '../../request'
export default {
_requestObj: null,
async getList(retryNum = 0) {
if (this._requestObj) this._requestObj.cancelHttp()
if (retryNum > 2) return Promise.reject(new Error('try max num'))
const _requestObj = httpFetch('http://jadeite.migu.cn:7090/music_search/v3/search/hotword')
const { body, statusCode } = await _requestObj.promise
if (statusCode != 200 || body.code !== '000000') throw new Error('获取热搜词失败')
// console.log(body, statusCode)
return { source: 'mg', list: this.filterList(body.data.hotwords[0].hotwordList) }
},
filterList(rawList) {
return rawList.filter(item => item.resourceType == 'song').map(item => item.word)
},
}
View on GitHub (pinned to 9c364b482e)
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.
Example fix
// before
const _requestObj = httpFetch('http://jadeite.migu.cn:7090/music_search/v3/search/hotword')
const { body, statusCode } = await _requestObj.promise
if (statusCode != 200 || body.code !== '000000') throw new Error('获取热搜词失败')
// after
const _requestObj = httpFetch('http://jadeite.migu.cn:7090/music_search/v3/search/hotword', {
headers: { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X)' },
})
const { body, statusCode } = await _requestObj.promise
if (statusCode != 200 || !body || body.code !== '000000') {
console.warn('mg hotSearch failed', { statusCode, code: body?.code })
if (retryNum < 2) return this.getList(retryNum + 1)
throw new Error('获取热搜词失败')
} Defensive patterns
Strategy: retry
Type guard
function isMiguHotSearchResponse(body) {
return body != null && typeof body === 'object' && body.code === '000000' && body.data != null && Array.isArray(body.data.hotwords)
} Try / catch
try {
const result = await mgHotSearch.getList()
} catch (err) {
if (err.message === '获取热搜词失败') {
console.warn('Migu hot search unavailable (check port 7090 firewall)')
return { source: 'mg', list: [] }
}
throw err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12).
Data as JSON: /api/errors/be1e9e270e35f924.
Report an issue: GitHub.