{"record":{"id":"427a4a12d768c643","repo":"actualbudget/actual","slug":"unhandled-edit-field-name-string-name","errorCode":null,"errorMessage":"Unhandled edit field name: ${String(name)}","messagePattern":"Unhandled edit field name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop-client/src/components/modals/EditFieldModal.tsx","lineNumber":262,"sourceCode":"        </>\n      );\n      break;\n\n    case 'amount':\n      label = t('Amount');\n      editor = ({ close }) => (\n        <Input\n          onEnter={value => {\n            onSelect(value);\n            close();\n          }}\n          style={inputStyle}\n        />\n      );\n      break;\n\n    default:\n      throw new Error(`Unhandled edit field name: ${String(name)}`);\n  }\n\n  return (\n    <Modal\n      name=\"edit-field\"\n      noAnimation={!isNarrowWidth}\n      onClose={onClose}\n      containerProps={{\n        style: {\n          height: isNarrowWidth\n            ? 'calc(var(--visual-viewport-height) * 0.85)'\n            : height,\n          padding: '15px 10px',\n          ...(width && { width }),\n          backgroundColor: theme.menuAutoCompleteBackground,\n        },\n      }}\n    >","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/desktop-client/src/components/modals/EditFieldModal.tsx#L244-L280","documentation":"EditFieldModal throws when the `name` prop of the field being edited doesn't match any of the field types its render switch knows how to draw (e.g. account, payee, notes, category, date, amount...). Each editable transaction field has a bespoke input branch; an unknown name means the modal was asked to edit a field it has no editor for.","triggerScenarios":"Dispatching an 'edit-field' modal with a `name` outside the supported set — e.g. a new transaction field added elsewhere (like a custom field or a renamed field) opened through edit-field without adding a render branch.","commonSituations":"Developers adding a new transaction field and wiring it to EditFieldModal without a case; plugins or custom code opening the modal with an arbitrary field name; typos in the field name string.","solutions":["Add a render branch for the reported field name in EditFieldModal's switch.","Correct the `name` passed when dispatching pushModal({ name: 'edit-field', ... }) to a supported field.","For custom fields, use the dedicated custom-field edit flow instead of edit-field.","Fall back to a generic text input or close the modal with a warning instead of throwing."],"exampleFix":"// before\ndefault:\n  throw new Error(`Unhandled edit field name: ${String(name)}`);\n// after\ncase 'cleared':\n  input = <Switch checked={value} onChange={onClose} />;\n  break;\ndefault:\n  console.warn('Unhandled edit field name:', name);\n  input = null;","handlingStrategy":"validation","validationCode":"const SUPPORTED_FIELDS = ['account', 'payee', 'notes', 'category', 'date', 'amount', 'cleared'] as const;\ntype Field = typeof SUPPORTED_FIELDS[number];\nif (!SUPPORTED_FIELDS.includes(name as Field)) {\n  console.warn('edit-field does not support:', name);\n  return; // don't open the modal\n}","typeGuard":"type EditableField = 'account' | 'payee' | 'notes' | 'category' | 'date' | 'amount' | 'cleared';\nfunction isEditableField(name: string): name is EditableField {\n  return ['account', 'payee', 'notes', 'category', 'date', 'amount', 'cleared'].includes(name);\n}","tryCatchPattern":"try {\n  renderField(name);\n} catch (err) {\n  if (String(err).includes('Unhandled edit field')) {\n    return null; // render modal without input, or skip opening it\n  }\n  throw err;\n}","preventionTips":["Only dispatch the edit-field modal for fields in the supported union.","Use a shared exported type for editable field names across dispatch sites and the modal.","Custom/user-defined fields should route through the custom-fields editor, not edit-field."],"tags":["react","modal","switch-statement","developer-error"],"backgroundTag":"unhandled-switch-case","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}