lyswhut/lx-music-desktop · error · Error
Unknown action: ${action}
Error message
Unknown action: ${action} What it means
Songlist deep-link action dispatcher in useSonglistAction.js:110. The switch at lines 102-110 accepts only 'open' and 'play'; any other action token hits default and throws 'Unknown action: <token>'. This is the entry point returned by the module's default export.
Source
Thrown at src/renderer/core/useApp/useDeeplink/useSonglistAction.js:110
await playSongListDetail(songlistInfo.source, songlistInfo.id ?? songlistInfo.url, songlistInfo.index)
}
}
export default () => {
const handleOpenSonglist = useOpenSonglist()
const handlePlaySonglist = usePlaySonglistDetail()
return async(action, info) => {
switch (action) {
case 'open':
handleOpenSonglist(info)
break
case 'play':
await handlePlaySonglist(info)
break
default: throw new Error('Unknown action: ' + action)
}
}
}
View on GitHub (pinned to 9c364b482e)
Solutions
- Confirm the action token is exactly 'open' or 'play'.
- Catch at the deeplink router and surface unknown actions via useDialog().
- Add new verbs to the switch when extending the protocol.
- Log unknown actions to spot sender/receiver drift.
Example fix
// before
default: throw new Error('Unknown action: ' + action)
// after - explicit set + clear message
const SONGLIST_ACTIONS = new Set(['open', 'play'])
// before dispatch:
if (!SONGLIST_ACTIONS.has(action)) {
throw new Error(`Unknown songlist action: '${action}'. Expected 'open' or 'play'`)
} Defensive patterns
Strategy: validation
Validate before calling
const SONGLIST_ACTIONS = new Set(['open', 'play'])
if (!SONGLIST_ACTIONS.has(action)) {
showErrorDialog(`Unknown songlist action: ${action}`)
return
} Type guard
const SONGLIST_ACTIONS = ['open', 'play'] as const type SonglistAction = typeof SONGLIST_ACTIONS[number] const isSonglistAction = (a) => typeof a === 'string' && (SONGLIST_ACTIONS as readonly string[]).includes(a)
Try / catch
try {
await songlistDispatcher(action, info)
} catch (e) {
errorDialog(e.message)
} Prevention
- Share one constant for the songlist action set between router and dispatcher.
- Log unknown actions to detect sender/receiver drift.
- Always wrap the dispatcher at the router with useDialog() on failure.
When it happens
Trigger: The deeplink router invokes the songlist hook with an action other than open/play — e.g. 'view', 'add', undefined, or an empty string from a malformed URL.
Common situations: Protocol version skew; a sender using a verb this build doesn't handle; an integration typo in the URL template.
Related errors
- Unknown action: ${action}
- Unknown action: ${action}
- id or url missing
- Unknown source: ${musicInfo.source}
- Source no match
AI-assisted analysis of lyswhut/lx-music-desktop@9c364b482e (2026-08-12).
Data as JSON: /api/errors/780b343e7a65db05.
Report an issue: GitHub.