{"record":{"id":"fed881fa8c7d9a75","repo":"jely2002/youtube-dl-gui","slug":"unknown-shortcut-action-event-payload-action","errorCode":null,"errorMessage":"Unknown shortcut action: ${event.payload.action}","messagePattern":"Unknown shortcut action: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/tauri/listeners/shortcuts.ts","lineNumber":33,"sourceCode":"          return;\n        }\n        await mediaStore.dispatchMediaInfoFetch(url, true);\n        break;\n      }\n      case 'media_add_and_download': {\n        const url = await readText();\n        if (!isValidUrl(url)) {\n          return;\n        }\n        await mediaStore.addAndDownload(url, true);\n        break;\n      }\n      case 'download_all': {\n        await mediaStore.downloadAllGroups(true);\n        break;\n      }\n      default: {\n        console.warn(`Unknown shortcut action: ${event.payload.action}`);\n      }\n    }\n  });\n}\n","sourceCodeStart":15,"sourceCodeEnd":38,"githubUrl":"https://github.com/jely2002/youtube-dl-gui/blob/c402ee39c0eabab68934c48f8b787ff37a1577b0/src/tauri/listeners/shortcuts.ts#L15-L38","documentation":"registerShortcutListeners subscribes to a Tauri shortcut event and dispatches each payload's action to the matching store call via a switch. Unknown action strings fall into the default case, logging 'Unknown shortcut action: ${event.payload.action}' with console.warn — no exception is raised, and other shortcuts keep working.","triggerScenarios":"A global shortcut event arrives whose payload.action is not one of the handled cases — the Rust side registered a new/renamed action the TS handler does not know, a typo in the action string, or stale frontend code after a backend update.","commonSituations":"Backend and frontend updated out of sync (added a shortcut action in Rust but not in the TS switch); plugin update changing action names; custom user shortcut config emitting an unsupported action.","solutions":["Compare the action string in the warning against the switch cases in shortcuts.ts and add/rename the missing case.","Keep the Rust shortcut registrations and the TS switch in one synchronized list (shared constant or codegen).","Update frontend and backend together when adding shortcut actions so both deploy in the same release.","Ignore the warning for third-party/unrecognized actions if the handler should be forward-compatible."],"exampleFix":"// before\ncase 'download_all': { ... break; }\ndefault: { console.warn(`Unknown shortcut action: ${event.payload.action}`); }\n// after\ncase 'download_all': { ... break; }\ncase 'newly_added_action': { ... break; } // sync with Rust registration\ndefault: { console.warn(`Unknown shortcut action: ${event.payload.action}`); }","handlingStrategy":"validation","validationCode":"const KNOWN_ACTIONS = ['pause_all', 'download_all'] as const;\ntype ShortcutAction = typeof KNOWN_ACTIONS[number];\nconst isKnownAction = (a: string): a is ShortcutAction => (KNOWN_ACTIONS as readonly string[]).includes(a);","typeGuard":"const isShortcutAction = (a: string): a is ShortcutAction => (KNOWN_ACTIONS as readonly string[]).includes(a);","tryCatchPattern":"const action = event.payload.action;\nif (!isKnownAction(action)) {\n  console.warn(`Unknown shortcut action: ${action}`);\n  return; // forward-compatible: ignore future actions\n}","preventionTips":["Keep the Rust shortcut registrations and the TS switch cases in one synchronized constant list.","Ship backend and frontend shortcut changes in the same release.","Add a unit test asserting every registered backend action has a handler case."],"tags":["tauri","shortcuts","event-handling","console-warning"],"backgroundTag":"invalid-enum-value","analyzedSha":"c402ee39c0eabab68934c48f8b787ff37a1577b0","analyzedAt":"2026-09-12T02:01:12.452Z","contentChangedAt":"2026-09-12T02:01:12.452Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}