Molunerfinn/PicGo · error · Error
Shortcut not found: ${shortcutId}
Error message
Shortcut not found: ${shortcutId} What it means
updateShortcutKeys reads appConfig.settings.shortKey and throws this templated error when no shortcut exists under the given shortcutId. The action needs the existing shortcut's enable state, key, label and name to build the update payload for settingsAdapter.updateShortcut, so an unknown id is rejected before any IPC call.
Source
Thrown at src/renderer/store/settings/actions.ts:111
})
useAppStore.setState((state) => {
if (!state.appConfig) {
return
}
state.appConfig.picBed.proxy = proxy
})
},
async updateShortcutKeys (shortcutId: string, keys: string[]) {
await appActions.ensureSettingsHydrated()
const currentShortKey =
useAppStore.getState().appConfig?.settings.shortKey ??
defaultSettingsConfig.shortKey
const targetShortcut = currentShortKey[shortcutId]
if (!targetShortcut) {
throw new Error(`Shortcut not found: ${shortcutId}`)
}
const nextKey = keys.join('+')
const [from = 'picgo'] = shortcutId.split(':')
const didUpdate = await settingsAdapter.updateShortcut({
enable: targetShortcut.enable,
key: nextKey,
label: targetShortcut.label,
name: targetShortcut.name,
from
}, targetShortcut.key)
if (!didUpdate) {
throw new Error(`Failed to update shortcut: ${shortcutId}`)
}
updateSettingsState({
shortKey: {View on GitHub (pinned to 07ec7068a5)
Solutions
- Wait for appConfig hydration and enumerate the actual shortcut ids from appConfig.settings.shortKey before updating.
- Validate shortcutId against Object.keys(currentShortKey) in the caller before invoking the action.
- Update the shortcut id to the current version's id (check the shortcut settings UI or constants).
- Initialize missing shortcuts into defaultSettingsConfig.shortKey if the id is legitimately new.
Example fix
// before
await settingsStoreActions.updateShortcutKeys(shortcutId, keys)
// after
const shortKey = useAppStore.getState().appConfig?.settings.shortKey
if (!shortKey?.[shortcutId]) {
toast.warning(`Unknown shortcut: ${shortcutId}`)
return
}
await settingsStoreActions.updateShortcutKeys(shortcutId, keys) Defensive patterns
Strategy: validation
Validate before calling
const shortKey = useAppStore.getState().appConfig?.settings.shortKey
?? defaultSettingsConfig.shortKey
if (!(shortcutId in shortKey)) {
// unknown shortcut id — abort before update
return
} Type guard
function isKnownShortcut(
shortKey: Record<string, IShortKeyConfig>,
shortcutId: string
): shortcutId is string & keyof typeof shortKey {
return Object.prototype.hasOwnProperty.call(shortKey, shortcutId)
} Try / catch
try {
await settingsStoreActions.updateShortcutKeys(shortcutId, keys)
} catch (err) {
if ((err as Error).message.startsWith('Shortcut not found')) {
toast.warning(`Unknown shortcut: ${shortcutId}`)
}
} Prevention
- Wait for appConfig hydration before any shortcut mutation.
- Enumerate ids with Object.keys(shortKey) to build UI lists — never hardcode ids.
- Re-validate persisted shortcut ids after app upgrades.
- Keep the fallback defaultSettingsConfig.shortKey in sync with real ids.
When it happens
Trigger: Calling updateShortcutKeys(shortcutId, keys) with an id not present in shortKey (typo, renamed id, or shortcut map not yet loaded from appConfig so the code fell back to defaultSettingsConfig.shortKey which lacks the id).
Common situations: Shortcut ids changed between app versions; calling before settings are hydrated (appConfig still undefined, default map used); hardcoding an id like 'picgo:upload' that no longer exists.
Related errors
- Failed to update shortcut: ${shortcutId}
- ALBUM_URL_REWRITE_TEMP_RULE_REQUIRED
- Invalid URL rewrite regex pattern "${rule.match}": ${error i
- TIPS_UPLOADER_CONFIG_NAME_EMPTY
- Failed to delete provider config
AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30).
Data as JSON: /api/errors/262375cf944e8376.
Report an issue: GitHub.