stablyai/orca · error · Error

Could not normalize legacy binding for "${failedActionIds.jo

Error message

Could not normalize legacy binding for "${failedActionIds.join('", "')}."

What it means

Thrown at the end of the legacy-binding seed migration when one or more actionIds could not be normalized (normalizeKeybindingArrayForAction returned a non-array result). The error lists every failed actionId so the user can see which legacy bindings were rejected. The successful pins are still written before this throws.

Source

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

  const failedActionIds: KeybindingActionId[] = []
  for (const actionId of toSeed) {
    const normalized = normalizeKeybindingArrayForAction(actionId, legacyBindings[actionId] ?? [])
    if (!Array.isArray(normalized)) {
      failedActionIds.push(actionId)
      continue
    }
    pins.push([actionId, normalized])
  }
  const snapshot =
    pins.length > 0
      ? writeActivePlatformSection(path, platform, current.commonOverrides, (activePlatform) => {
          for (const [actionId, normalized] of pins) {
            activePlatform[actionId] = normalized
          }
        })
      : current
  if (failedActionIds.length > 0) {
    throw new Error(`Could not normalize legacy binding for "${failedActionIds.join('", "')}".`)
  }
  return { seeded: pins.length > 0, snapshot }
}

// Why: the one-shot seed migration and Settings writes must produce the same
// on-disk document shape; a single assembly path keeps them from drifting.
function writeActivePlatformSection(
  path: string,
  platform: NodeJS.Platform,
  fallbackCommonOverrides: KeybindingOverrides,
  mutateActivePlatform: (activePlatform: JsonObject) => void
): KeybindingFileSnapshot {
  const keybindingPlatform = getKeybindingPlatform(platform)
  const readResult = readJsonDocument(path)
  if (!readResult.document) {
    // Why: writes must never replace a user-owned file that could not be
    // parsed; callers surface the error (or retry the migration) after repair.
    throw new Error(readResult.error ?? 'Could not read keybindings file.')

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Open the keybindings file and fix or remove the listed actionIds' bindings using current token syntax.
  2. Re-run the migration (it is idempotent — already-written pins are skipped).
  3. If an actionId was removed entirely, delete that legacy entry.
  4. Re-record those shortcuts through the Settings UI.

Example fix

// before (legacy file)
{ "oldActionName": "Cmd+Shift+P" }
// after (after fixing to current actionId + array form)
{ "platforms": { "darwin": { "command.palette.open": ["Cmd+Shift+P"] } } }
Defensive patterns

Strategy: try-catch

Validate before calling

const failed = actionIds.filter((id) => !Array.isArray(normalizeKeybindingArrayForAction(id, legacyBindings[id] ?? [])))
if (failed.length) await runKeybindingsRepairUI(failed)

Type guard

function canNormalizeLegacy(actionId: KeybindingActionId, legacy: readonly string[]): boolean {
  return Array.isArray(normalizeKeybindingArrayForAction(actionId, legacy))
}

Try / catch

try { seedLegacyKeybindings(path, platform) }
catch (e) { if (/Could not normalize legacy binding/.test(String((e as Error).message))) openKeybindingsRepair(extractFailedActionIds(e)); else throw e }

Prevention

When it happens

Trigger: Migrating an old keybindings file whose entries for certain actionIds use a syntax the current normalizer rejects (renamed actions, deprecated key tokens, malformed combos). The migration writes the valid bindings then raises so the user knows some did not carry over.

Common situations: Upgrading Orca across a version that renamed/removed keybinding actions or changed token grammar (e.g. 'Cmd' → 'Meta'). Importing a keybindings file from another OS or an older major version.

Related errors


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