stablyai/orca · error · Error

Unable to parse shortcut.

Error message

Unable to parse shortcut.

What it means

Thrown by normalizeWriteBindingValue when normalizeKeybindingArrayForAction returns a non-array result whose .ok is true — i.e. a single normalized binding object instead of the expected array form. The 'Unable to parse shortcut.' message is the fallback when no specific error string was produced, signalling an internal shape inconsistency in the per-action normalizer.

Source

Thrown at src/main/keybindings/keybinding-file.ts:124

    return Array.isArray(normalized)
      ? { ok: true, value: normalized }
      : normalized.ok
        ? { ok: true, value: [normalized.value] }
        : normalized
  }
  return { ok: false, error: 'Use a string, string array, null, or false.' }
}

function normalizeWriteBindingValue(actionId: KeybindingActionId, value: unknown): string[] | null {
  if (value === null) {
    return null
  }
  if (!Array.isArray(value) || !value.every((binding) => typeof binding === 'string')) {
    throw new Error('Use a string array or null.')
  }
  const normalized = normalizeKeybindingArrayForAction(actionId, value)
  if (!Array.isArray(normalized)) {
    throw new Error(normalized.ok ? 'Unable to parse shortcut.' : normalized.error)
  }
  return normalized
}

function parseBindingSection(
  value: unknown,
  section: string,
  diagnostics: KeybindingFileDiagnostic[],
  options: { skipRootKeys?: boolean } = {}
): KeybindingOverrides {
  if (value === undefined) {
    return {}
  }
  if (!isJsonObject(value)) {
    diagnostics.push({
      severity: 'error',
      section,
      message: `${section} must be an object.`

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Check normalizeKeybindingArrayForAction for the offending actionId and ensure it returns string[] on success.
  2. Report the actionId to the Orca maintainers with the value that triggered it.
  3. As a workaround, re-enter the binding through the UI capture control which produces array form.

Example fix

// before
function normalizeKeybindingArrayForAction(actionId, value) { return { ok: true, value: 'Cmd+K' } }
// after
function normalizeKeybindingArrayForAction(actionId, value) { return ['Cmd+K'] }
Defensive patterns

Strategy: try-catch

Validate before calling

const normalized = normalizeKeybindingArrayForAction(actionId, value)
if (!Array.isArray(normalized)) reportInternalNormalizerShape(actionId, normalized)

Type guard

function isStringArray(v: unknown): v is string[] { return Array.isArray(v) && v.every((x) => typeof x === 'string') }

Try / catch

try { writeKeybindingOverride(path, platform, actionId, bindings) }
catch (e) { if (/Unable to parse shortcut/.test(String((e as Error).message))) reportOrcaBug(actionId, bindings); else throw e }

Prevention

When it happens

Trigger: The per-action normalizer for an actionId returned a single-binding success object ({ok:true,value}) rather than an array, while the write path expected an array. This is an internal/programming error, not a user typo.

Common situations: A new KeybindingActionId was added whose normalizer has a different return shape, or the action's binding semantics were changed to single-binding without updating the write path.

Understand the failure class

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/65cfca6748ef4e47. Report an issue: GitHub.