{"record":{"id":"fd56611337ab62ec","repo":"actualbudget/actual","slug":"unrecognized-menu-option-name-fd5661","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/modals/ScheduledTransactionMenuModal.tsx","lineNumber":143,"sourceCode":"  return (\n    <Menu\n      {...props}\n      onMenuSelect={name => {\n        switch (name) {\n          case 'post':\n            onPost?.(transactionId);\n            break;\n          case 'post-today':\n            onPost?.(transactionId, true);\n            break;\n          case 'skip':\n            onSkip?.(transactionId);\n            break;\n          case 'complete':\n            onComplete?.(transactionId);\n            break;\n          default:\n            throw new Error(`Unrecognized menu option: ${name}`);\n        }\n      }}\n      items={[\n        { name: 'post', text: t('Post transaction') },\n        { name: 'post-today', text: t('Post transaction today') },\n        ...(canBeSkipped\n          ? [{ name: 'skip', text: t('Skip next scheduled date') }]\n          : []),\n        ...(canBeCompleted\n          ? [{ name: 'complete', text: t('Mark as completed') }]\n          : []),\n      ]}\n    />\n  );\n}\n","sourceCodeStart":125,"sourceCodeEnd":159,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx#L125-L159","documentation":"ScheduledTransactionMenu throws when a scheduled-transaction menu option has no case in its onSelect switch. Known cases include post, post-today, skip, and complete; the default branch treats any other name as an internal bug and throws.","triggerScenarios":"Choosing a menu item for a scheduled transaction whose `name` isn't in the switch — e.g. after adding a new option to the `items` array (like 'edit' or 'delete') without a corresponding case.","commonSituations":"New menu items added in a feature branch without updating onSelect; a typo in a name string between items and cases; forks/patches extending the schedule menu.","solutions":["Add the missing case to the onSelect switch in ScheduledTransactionMenu.","Cross-check each entry in the items array against the switch cases; fix any string mismatches.","Log and ignore unknown options instead of throwing if graceful degradation is preferred.","Type items' names as a closed union shared by both the items array and the switch."],"exampleFix":"// before\ncase 'complete':\n  onComplete?.(transactionId);\n  break;\ndefault:\n  throw new Error(`Unrecognized menu option: ${name}`);\n// after\ncase 'complete':\n  onComplete?.(transactionId);\n  break;\ncase 'edit':\n  onEdit?.(transactionId);\n  break;\ndefault:\n  console.warn('Unrecognized menu option:', name);","handlingStrategy":"type-guard","validationCode":"const HANDLED = new Set(['post', 'post-today', 'skip', 'complete']);\nif (!HANDLED.has(name)) {\n  console.warn('Unknown schedule menu option:', name);\n  return;\n}","typeGuard":"type ScheduleMenuOption = 'post' | 'post-today' | 'skip' | 'complete';\nfunction isScheduleMenuOption(name: string): name is ScheduleMenuOption {\n  return ['post', 'post-today', 'skip', 'complete'].includes(name);\n}","tryCatchPattern":"try {\n  onSelect(name);\n} catch (err) {\n  if (String(err).includes('Unrecognized menu option')) {\n    console.warn('Unhandled schedule option', name);\n  } else {\n    throw err;\n  }\n}","preventionTips":["Keep a single source of truth (union type) for schedule menu option names.","When adding an item to the items array, add the case in the same commit.","Cover all schedule menu options in component tests."],"tags":["react","menu","schedules","switch-statement"],"backgroundTag":"unhandled-switch-case","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}