{"record":{"id":"30222f5988a07c43","repo":"lyswhut/lx-music-desktop","slug":"quality-no-match","errorCode":null,"errorMessage":"quality no match","messagePattern":"quality no match","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderer/core/useApp/useDeeplink/utils.js","lineNumber":28,"sourceCode":"    })\n  }\n\n  return errorDialog\n}\n\nexport const sources = ['kw', 'kg', 'tx', 'wy', 'mg']\nexport const sourceVerify = source => {\n  if (!sources.includes(source)) throw new Error('Source no match')\n}\n\nexport const qualitys = ['128k', '320k', 'flac', 'flac24bit']\nexport const qualityFilter = (source, types) => {\n  types = types.filter(({ type }) => qualitys.includes(type)).map(({ type, size, hash }) => {\n    if (size != null && typeof size != 'string') throw new Error(type + ' size type no match')\n    if (source == 'kg' && typeof hash != 'string') throw new Error(type + ' hash type no match')\n    return hash == null ? { type, size } : { type, size, hash }\n  })\n  if (!types.length) throw new Error('quality no match')\n  return types\n}\n\nexport const dataVerify = (rules, data) => {\n  const newData = {}\n  for (const rule of rules) {\n    const val = data[rule.key]\n    if (rule.required && val == null) throw new Error(rule.key + ' missing')\n    if (val != null) {\n      if (rule.types && !rule.types.includes(typeof val)) throw new Error(rule.key + ' type no match')\n      if (rule.max && String(val).length > rule.max) throw new Error(rule.key + ' max length no match')\n      if (rule.min && String(val).length > rule.min) throw new Error(rule.key + ' min length no match')\n    }\n    newData[rule.key] = val\n  }\n  return newData\n}\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/lyswhut/lx-music-desktop/blob/9c364b482e5621a1d38b50e8610d2fb974457e6e/src/renderer/core/useApp/useDeeplink/utils.js#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the payload includes at least one of 128k/320k/flac/flac24bit in its types.","Map the sender's quality names to the supported set before calling qualityFilter.","Catch the throw and show a 'no playable quality for this track' dialog instead of a raw error.","If the provider added a new tier, add it to the `qualitys` array in utils.js."],"exampleFix":"// before\n  if (!types.length) throw new Error('quality no match')\n\n// after - degrade to a user-facing message via the dialog\n  if (!types.length) throw new Error('quality no match: none of the provided types are playable (need one of 128k, 320k, flac, flac24bit)')","handlingStrategy":"validation","validationCode":"import { qualitys } from './utils'\nconst hasPlayableQuality = (types) =>\n  Array.isArray(types) && types.some(t => qualitys.includes(t?.type))\nif (!hasPlayableQuality(musicInfo.types)) {\n  showErrorDialog('No playable quality for this track')\n  return\n}","typeGuard":"import { qualitys } from './utils'\nconst hasPlayableQuality = (types) =>\n  Array.isArray(types) && types.some(t => t != null && typeof t === 'object' && qualitys.includes(t.type))","tryCatchPattern":"try {\n  musicInfo.types = qualityFilter(musicInfo.source, musicInfo.types)\n} catch (e) {\n  errorDialog(e.message)\n}","preventionTips":["Ensure the sender advertises at least one of 128k/320k/flac/flac24bit.","Map the sender's quality names to the supported set before validating.","When a provider adds a tier, add it to `qualitys` in utils.js."],"tags":["deeplink","validation","quality","playback"],"backgroundTag":null,"analyzedSha":"9c364b482e5621a1d38b50e8610d2fb974457e6e","analyzedAt":"2026-08-12T15:14:48.244Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}