{"record":{"id":"d8b85c2c2804001e","repo":"actualbudget/actual","slug":"unrecognized-menu-option-name-d8b85c","errorCode":null,"errorMessage":"Unrecognized menu option: ${name}","messagePattern":"Unrecognized menu option: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop-client/src/components/budget/envelope/budgetsummary/ToBudgetMenu.tsx","lineNumber":103,"sourceCode":"        switch (name) {\n          case 'transfer':\n            onTransfer?.();\n            break;\n          case 'cover':\n            onCover?.();\n            break;\n          case 'buffer':\n            onHoldBuffer?.();\n            onBudgetAction?.(month, 'reset-income-carryover', {});\n            break;\n          case 'reset-buffer':\n            onResetHoldBuffer?.();\n            break;\n          case 'disable-auto-buffer':\n            onBudgetAction?.(month, 'reset-income-carryover', {});\n            break;\n          default:\n            throw new Error(`Unrecognized menu option: ${name}`);\n        }\n      }}\n      items={\n        items.length > 0\n          ? items\n          : [\n              {\n                name: 'none',\n                text: t('No actions available'),\n                disabled: true,\n              },\n            ]\n      }\n    />\n  );\n}\n","sourceCodeStart":85,"sourceCodeEnd":120,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/desktop-client/src/components/budget/envelope/budgetsummary/ToBudgetMenu.tsx#L85-L120","documentation":"ToBudgetMenu's onMenuSelect switch handles options like resetting the hold buffer and disabling the auto-buffer; any selected item name without a matching case hits the default branch, which throws `Unrecognized menu option: ${name}`. Like BudgetMonthMenu, it enforces that every entry in the (possibly computed) items list has a handler.","triggerScenarios":"A menu item name not among the implemented cases ('reset-hold-buffer', 'disable-auto-buffer', etc.) is selected — a new/renamed item added to `items` (including the conditional `items.length > 0 ? items : [...]` branch) without a switch case, or an externally supplied item.","commonSituations":"Adding a new ToBudget action and missing the handler; renaming a case but not the item; passing custom items via props with names the switch doesn't know.","solutions":["Add the missing `case` to the onMenuSelect switch in ToBudgetMenu.tsx","Align the item's `name` string with an existing case (fix typos/renames)","Log and ignore unknown options in the default branch if dynamic items must be supported"],"exampleFix":"// before\ndefault:\n  throw new Error(`Unrecognized menu option: ${name}`);\n// after\ncase 'reset-hold-buffer':\n  onResetHoldBuffer?.();\n  break;\ndefault:\n  console.warn(`Unrecognized menu option: ${name}`);","handlingStrategy":"validation","validationCode":"const KNOWN_TO_BUDGET_OPTIONS = ['reset-hold-buffer','disable-auto-buffer'];\nitems.filter(i => !KNOWN_TO_BUDGET_OPTIONS.includes(i.name))\n  .forEach(i => console.warn(`Dropping unhandled ToBudgetMenu item: ${i.name}`));","typeGuard":"type ToBudgetMenuOption = 'reset-hold-buffer' | 'disable-auto-buffer';\nfunction isToBudgetOption(name: string): name is ToBudgetMenuOption {\n  return name === 'reset-hold-buffer' || name === 'disable-auto-buffer';\n}","tryCatchPattern":"onMenuSelect={name => {\n  try {\n    handleOption(name);\n  } catch (e) {\n    if (String(e?.message).startsWith('Unrecognized menu option')) return;\n    throw e;\n  }\n}}","preventionTips":["Derive the switch cases and the items array from a single typed registry of actions","Enable TS exhaustive switch checking on the option union type","Test every item name in both item branches (custom items and fallback list)","Prefer warn-and-ignore over throw for menu options that may come from external sources"],"tags":["switch-default","unhandled-menu-item","react","budget-ui"],"backgroundTag":"unrecognized-enum-value","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}