lyswhut/lx-music-desktop · error · Error

quality no match

Error message

quality no match

What it means

qualityFilter (utils.js:28) keeps only entries whose `type` is one of ['128k','320k','flac','flac24bit']. If none survive the filter, there are no playable qualities for the track, so it throws 'quality no match' rather than returning an empty types array that would break downstream playback.

Source

Thrown at src/renderer/core/useApp/useDeeplink/utils.js:28

    })
  }

  return errorDialog
}

export const sources = ['kw', 'kg', 'tx', 'wy', 'mg']
export const sourceVerify = source => {
  if (!sources.includes(source)) throw new Error('Source no match')
}

export const qualitys = ['128k', '320k', 'flac', 'flac24bit']
export const qualityFilter = (source, types) => {
  types = types.filter(({ type }) => qualitys.includes(type)).map(({ type, size, hash }) => {
    if (size != null && typeof size != 'string') throw new Error(type + ' size type no match')
    if (source == 'kg' && typeof hash != 'string') throw new Error(type + ' hash type no match')
    return hash == null ? { type, size } : { type, size, hash }
  })
  if (!types.length) throw new Error('quality no match')
  return types
}

export const dataVerify = (rules, data) => {
  const newData = {}
  for (const rule of rules) {
    const val = data[rule.key]
    if (rule.required && val == null) throw new Error(rule.key + ' missing')
    if (val != null) {
      if (rule.types && !rule.types.includes(typeof val)) throw new Error(rule.key + ' type no match')
      if (rule.max && String(val).length > rule.max) throw new Error(rule.key + ' max length no match')
      if (rule.min && String(val).length > rule.min) throw new Error(rule.key + ' min length no match')
    }
    newData[rule.key] = val
  }
  return newData
}

View on GitHub (pinned to 9c364b482e)

Solutions

  1. Ensure the payload includes at least one of 128k/320k/flac/flac24bit in its types.
  2. Map the sender's quality names to the supported set before calling qualityFilter.
  3. Catch the throw and show a 'no playable quality for this track' dialog instead of a raw error.
  4. If the provider added a new tier, add it to the `qualitys` array in utils.js.

Example fix

// before
  if (!types.length) throw new Error('quality no match')

// after - degrade to a user-facing message via the dialog
  if (!types.length) throw new Error('quality no match: none of the provided types are playable (need one of 128k, 320k, flac, flac24bit)')
Defensive patterns

Strategy: validation

Validate before calling

import { qualitys } from './utils'
const hasPlayableQuality = (types) =>
  Array.isArray(types) && types.some(t => qualitys.includes(t?.type))
if (!hasPlayableQuality(musicInfo.types)) {
  showErrorDialog('No playable quality for this track')
  return
}

Type guard

import { qualitys } from './utils'
const hasPlayableQuality = (types) =>
  Array.isArray(types) && types.some(t => t != null && typeof t === 'object' && qualitys.includes(t.type))

Try / catch

try {
  musicInfo.types = qualityFilter(musicInfo.source, musicInfo.types)
} catch (e) {
  errorDialog(e.message)
}

Prevention

When it happens

Trigger: A play-music payload whose musicInfo.types is empty, or contains only unsupported quality tokens (e.g. 'sq', 'hires', 'master') — none intersect the supported set, so the filtered list has length 0.

Common situations: The sender advertises qualities this build cannot play; the `types` array is malformed or its entries lack a `type` field; a provider renamed its quality codes.

Related errors


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