{"record":{"id":"0f7a3f12c66ddf52","repo":"actualbudget/actual","slug":"internal-error-category-categoryidtomove-is-no-0f7a3f","errorCode":null,"errorMessage":"Internal error: category ${categoryIdToMove} is not in a group and cannot be moved.","messagePattern":"Internal error: category (.+?) is not in a group and cannot be moved\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop-client/src/components/mobile/budget/IncomeCategoryList.tsx","lineNumber":64,"sourceCode":"              borderRadius: 4,\n            },\n          })}\n        />\n      );\n    },\n    onReorder: e => {\n      const [key] = e.keys;\n      const categoryIdToMove = key as CategoryEntity['id'];\n      const categoryToMove = categories.find(c => c.id === categoryIdToMove);\n\n      if (!categoryToMove) {\n        throw new Error(\n          `Internal error: category with ID ${categoryIdToMove} not found.`,\n        );\n      }\n\n      if (!categoryToMove.group) {\n        throw new Error(\n          `Internal error: category ${categoryIdToMove} is not in a group and cannot be moved.`,\n        );\n      }\n\n      const targetCategoryId = e.target.key as CategoryEntity['id'];\n\n      if (e.target.dropPosition === 'before') {\n        moveCategory.mutate({\n          id: categoryToMove.id,\n          groupId: categoryToMove.group,\n          targetId: targetCategoryId,\n        });\n      } else if (e.target.dropPosition === 'after') {\n        const targetCategoryIndex = categories.findIndex(\n          c => c.id === targetCategoryId,\n        );\n\n        if (targetCategoryIndex === -1) {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/desktop-client/src/components/mobile/budget/IncomeCategoryList.tsx#L46-L82","documentation":"IncomeCategoryList throws this when the dragged category exists but has no `group` reference, which is required to compute its reorder position. A group-less income category is treated as invalid internal state that cannot be safely moved.","triggerScenarios":"`onReorder` is called with a category whose `categoryToMove.group` is undefined/null — the category was loaded without its group relation or has no group in the data model.","commonSituations":"Import/sync produced categories without group assignments; the data query omitted the group relation; a programmatically created category lacks a group ID.","solutions":["Ensure the categories query includes each category's group relation.","Assign the orphan category to an income group before reordering.","Validate category/group integrity after import or sync.","Skip group-less categories during reorder instead of throwing."],"exampleFix":"// before\nif (!categoryToMove.group) {\n  throw new Error(`Internal error: category ${categoryIdToMove} is not in a group and cannot be moved.`);\n}\n// after\nif (!categoryToMove.group) {\n  console.warn(`Category ${categoryIdToMove} has no group; skipping reorder`);\n  return;\n}","handlingStrategy":"validation","validationCode":"if (!categoryToMove?.group) {\n  console.warn(`Category ${categoryIdToMove} has no group; skipping reorder`);\n  return;\n}","typeGuard":"function hasGroup(c: CategoryEntity): c is CategoryEntity & { group: NonNullable<CategoryEntity['group']> } {\n  return Boolean(c.group);\n}","tryCatchPattern":"try {\n  onReorder(e);\n} catch (err) {\n  if (String(err).includes('not in a group')) {\n    refreshCategories();\n  } else {\n    throw err;\n  }\n}","preventionTips":["Always include the group relation when loading income categories.","Assign every category to a group at creation/import time.","Run integrity checks after sync to catch group-less categories.","Filter group-less categories out of reorderable lists."],"tags":["ui","drag-and-drop","data-integrity","internal-error"],"backgroundTag":"missing-required-relation","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}