Molunerfinn/PicGo · error · Error

Failed to update shortcut: ${shortcutId}

Error message

Failed to update shortcut: ${shortcutId}

What it means

updateShortcutKeys calls settingsAdapter.updateShortcut(...) which registers the new global shortcut in the main process and returns a boolean didUpdate. This error is thrown when the adapter returns false — the shortcut could not be registered/updated, most commonly because the key combination is already bound by another application or another PicGo shortcut. Note the local shortKey state is only mutated after this check, so no partial update occurs.

Source

Thrown at src/renderer/store/settings/actions.ts:125

      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: {
        ...currentShortKey,
        [shortcutId]: {
          ...targetShortcut,
          key: nextKey
        }
      }
    })
  },
  async setShortcutEnabled (shortcutId: string, enable: boolean) {
    await appActions.ensureSettingsHydrated()
    const currentShortKey =
      useAppStore.getState().appConfig?.settings.shortKey ??
      defaultSettingsConfig.shortKey
    const targetShortcut = currentShortKey[shortcutId]

View on GitHub (pinned to 07ec7068a5)

Solutions

  1. Choose a different key combination that is not already registered by the OS or another app.
  2. Check for duplicate assignments among PicGo's own shortcuts before saving.
  3. Catch this error in the UI and show a 'shortcut in use' message with the offending shortcutId.
  4. Verify Electron can register the accelerator format (valid modifiers like CommandOrControl/Alt/Shift plus a key).

Example fix

// before
await settingsStoreActions.updateShortcutKeys(shortcutId, keys)

// after
try {
  await settingsStoreActions.updateShortcutKeys(shortcutId, keys)
} catch (err) {
  toast.error(`${(err as Error).message} — key combination may already be in use`)
}
Defensive patterns

Strategy: try-catch

Validate before calling

const combo = keys.join('+')
const duplicate = Object.entries(shortKey).some(
  ([id, cfg]) => id !== shortcutId && cfg.key === combo
)
if (duplicate) {
  // combination already used by another PicGo shortcut
  return
}

Type guard

function isRegistrationFailure(
  didUpdate: boolean | undefined
): didUpdate is false {
  return didUpdate !== true
}

Try / catch

try {
  await settingsStoreActions.updateShortcutKeys(shortcutId, keys)
} catch (err) {
  if ((err as Error).message.startsWith('Failed to update shortcut')) {
    toast.error(i18n.t('SHORTCUT_IN_USE', { shortcutId }))
  }
}

Prevention

When it happens

Trigger: Calling updateShortcutKeys(shortcutId, keys) where the joined keys (keys.join('+')) collide with an OS-level or in-app reserved shortcut, causing the main process globalShortcut.register to fail and the adapter to resolve false.

Common situations: User picks a combination already owned by the OS or another app (e.g. Cmd+Shift+4 on macOS); assigning the same combination to two PicGo shortcuts; Electron failing to register accelerators with unsupported modifier combos.

Related errors


AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30). Data as JSON: /api/errors/1f682329ebca5780. Report an issue: GitHub.