[Bug]: nYNAB import fails due to duplicate category names because one is hidden #1242

Closed
opened 2026-02-28 19:37:14 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @spuder on GitHub (Jul 16, 2024).

Verified issue does not already exist?

  • I have searched and found no existing issue
  • I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file)

What happened?

As a user attempting to import my 15 year old ynab budget, I'm encountering multiple errors at import

Error

Error: Category 'House' already exists in group 'xxx'
  at index.ts:367:13
Screenshot 2024-07-16 at 1 14 01 PM

Steps to reproduce

Import this modified ynab5-demo-budget.json which has an extra "Bills" section

ynab5-demo-budget.json

Theory

Looking at the json, it appears that I have multiple categories named "House", the difference is that some are 'hidden'

"categories": [
                {
                    "id": "8789398a-4bfd-46e6-9617-7cfd7a2b7a69",
                    "category_group_id": "bd2055f6-6c07-4639-aa5d-89241fd8a097",
                    "name": "House",
                    "hidden": false,
                    "original_category_group_id": null,
                    "note": "",
                    "budgeted": 0,
                    "activity": 0,
                    "balance": 0,
                    "goal_type": null,
                    "goal_needs_whole_amount": null,
                    "goal_day": null,
                    "goal_cadence": null,
                    "goal_cadence_frequency": null,
                    "goal_creation_month": null,
                    "goal_target": 0,
                    "goal_target_month": null,
                    "goal_percentage_complete": null,
                    "goal_months_to_budget": null,
                    "goal_under_funded": null,
                    "goal_overall_funded": null,
                    "goal_overall_left": null,
                    "deleted": false
                },
                {
                    "id": "cf55f5c3-c85b-4dd4-819d-b5cede037bc0",
                    "category_group_id": "bd2055f6-6c07-4639-aa5d-89241fd8a097",
                    "name": "House",
                    "hidden": true,
                    "original_category_group_id": null,
                    "note": "",
                    "budgeted": 0,
                    "activity": 0,
                    "balance": 0,
                    "goal_type": null,
                    "goal_needs_whole_amount": null,
                    "goal_day": null,
                    "goal_cadence": null,
                    "goal_cadence_frequency": null,
                    "goal_creation_month": null,
                    "goal_target": 0,
                    "goal_target_month": null,
                    "goal_percentage_complete": null,
                    "goal_months_to_budget": null,
                    "goal_under_funded": null,
                    "goal_overall_funded": null,
                    "goal_overall_left": null,
                    "deleted": false
                }
            ]

Solution

Actual should support multiple categories with the same name where the 'hidden' flag is set to true or false

Where are you hosting Actual?

Pikapods

What browsers are you seeing the problem on?

Chrome

Operating System

Mac OSX

Originally created by @spuder on GitHub (Jul 16, 2024). ### Verified issue does not already exist? - [X] I have searched and found no existing issue - [X] I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file) ### What happened? As a user attempting to import my 15 year old ynab budget, I'm encountering multiple errors at import ## Error ``` Error: Category 'House' already exists in group 'xxx' at index.ts:367:13 ``` <img width="1402" alt="Screenshot 2024-07-16 at 1 14 01 PM" src="https://github.com/user-attachments/assets/116af844-e335-4a11-b515-01863428f103"> ## Steps to reproduce Import this modified ynab5-demo-budget.json which has an extra "Bills" section [ynab5-demo-budget.json](https://github.com/user-attachments/files/16269139/ynab5-demo-budget.json) ## Theory Looking at the json, it appears that I have multiple categories named "House", the difference is that some are 'hidden' ``` "categories": [ { "id": "8789398a-4bfd-46e6-9617-7cfd7a2b7a69", "category_group_id": "bd2055f6-6c07-4639-aa5d-89241fd8a097", "name": "House", "hidden": false, "original_category_group_id": null, "note": "", "budgeted": 0, "activity": 0, "balance": 0, "goal_type": null, "goal_needs_whole_amount": null, "goal_day": null, "goal_cadence": null, "goal_cadence_frequency": null, "goal_creation_month": null, "goal_target": 0, "goal_target_month": null, "goal_percentage_complete": null, "goal_months_to_budget": null, "goal_under_funded": null, "goal_overall_funded": null, "goal_overall_left": null, "deleted": false }, { "id": "cf55f5c3-c85b-4dd4-819d-b5cede037bc0", "category_group_id": "bd2055f6-6c07-4639-aa5d-89241fd8a097", "name": "House", "hidden": true, "original_category_group_id": null, "note": "", "budgeted": 0, "activity": 0, "balance": 0, "goal_type": null, "goal_needs_whole_amount": null, "goal_day": null, "goal_cadence": null, "goal_cadence_frequency": null, "goal_creation_month": null, "goal_target": 0, "goal_target_month": null, "goal_percentage_complete": null, "goal_months_to_budget": null, "goal_under_funded": null, "goal_overall_funded": null, "goal_overall_left": null, "deleted": false } ] ``` ## Solution Actual should support multiple categories with the same name where the 'hidden' flag is set to true or false ### Where are you hosting Actual? Pikapods ### What browsers are you seeing the problem on? Chrome ### Operating System Mac OSX
GiteaMirror added the bug label 2026-02-28 19:37:14 -06:00
Author
Owner

@youngcw commented on GitHub (Jul 16, 2024):

For now your best bet is to either delete the old ones and re export from ynab or modify the json you already have to give them unique names.

@youngcw commented on GitHub (Jul 16, 2024): For now your best bet is to either delete the old ones and re export from ynab or modify the json you already have to give them unique names.
Author
Owner

@spuder commented on GitHub (Jul 17, 2024):

Attached a budget that reproduces the problem. ynab5-demo-budget.json

@spuder commented on GitHub (Jul 17, 2024): Attached a budget that reproduces the problem. [ynab5-demo-budget.json](https://github.com/user-attachments/files/16273952/ynab5-demo-budget.json)
Author
Owner

@spuder commented on GitHub (Jul 27, 2024):

I'm not making progress on this. Putting out a call for help from someone more experienced.

A solution should be as simple as doing something like this in async function importCategories( in packages/loot-core/src/server/importers/ynab5.ts

            default: {
              const newName = cat.hidden ? `${cat.name}-hidden` : cat.name;
              const id = await actual.createCategory({
                name: newName,
                group_id: groupId,
              });
              entityIdMap.set(cat.id, id);
              break;
            }

While this does fix the error so the budget loads, none of the hidden categories show up in the hidden group.

@spuder commented on GitHub (Jul 27, 2024): I'm not making progress on this. Putting out a call for help from someone more experienced. A solution should be as simple as doing something like this in `async function importCategories(` in `packages/loot-core/src/server/importers/ynab5.ts` ``` default: { const newName = cat.hidden ? `${cat.name}-hidden` : cat.name; const id = await actual.createCategory({ name: newName, group_id: groupId, }); entityIdMap.set(cat.id, id); break; } ``` While this does fix the error so the budget loads, none of the hidden categories show up in the hidden group.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#1242