lyswhut/lx-music-desktop · error · Error
${rule.key} max length no match
Error message
${rule.key} max length no match What it means
dataVerify (utils.js:39) enforces a maximum character length via `String(val).length > rule.max`. When a field's string form exceeds its cap (e.g. name/singer max 200, img/url max 500-1024, ids max 64) it throws '<key> max length no match'. The check stringifies, so numbers are measured by their digit count.
Source
Thrown at src/renderer/core/useApp/useDeeplink/utils.js:39
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
- Truncate the field at the sender to the documented max before constructing the link.
- Raise the rule's `max` if the larger size is legitimate for the field.
- Pre-truncate values before calling dataVerify (e.g. name.slice(0, 200)).
- Catch upstream and show which field overflowed via useDialog().
Example fix
// before
if (rule.max && String(val).length > rule.max) throw new Error(rule.key + ' max length no match')
// after - include observed length and limit
if (rule.max && String(val).length > rule.max) {
throw new Error(`${rule.key} max length no match: ${String(val).length} > ${rule.max}`)
} Defensive patterns
Strategy: validation
Validate before calling
const findOverMax = (rules, data) =>
rules.filter(r => r.max && data[r.key] != null && String(data[r.key]).length > r.max).map(r => r.key)
const over = findOverMax(rules, data)
if (over.length) {
showErrorDialog(`Field(s) too long: ${over.join(', ')}`)
return
} Type guard
const withinMax = (rule, data) => {
const v = data[rule.key]
return v == null || !rule.max || String(v).length <= rule.max
} Try / catch
try {
info = dataVerify(rules, info)
} catch (e) {
errorDialog(e.message)
} Prevention
- Truncate long fields (name/singer/img/url) at the sender to the documented caps.
- Pre-truncate values before dataVerify when accepting untrusted links.
- Note: utils.js:40 has a latent bug — the `min` check uses `>` instead of `<`; do not rely on it until fixed.
When it happens
Trigger: Any deep-link field whose string representation exceeds its declared max — a 300-character song name against max:200, a URL over 500/1024 chars, or a long albumName. The throw fires after the type check passes.
Common situations: Very long song/album/artist names from exotic metadata; injected or garbage data through an untrusted link; a URL with huge query params exceeding the 500/1024 caps.
Related errors
- ${rule.key} type no match
- Unknown source: ${musicInfo.source}
- Unknown action: ${action}
- Unknown action: ${action}
- id or url missing
AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12).
Data as JSON: /api/errors/5f02473a9560ecc8.
Report an issue: GitHub.