actual icon indicating copy to clipboard operation
actual copied to clipboard

[Bug]: Import from nYNAB fails with unknown error

Open Arnoud-B opened this issue 1 year ago • 11 comments

Verified issue does not already exist?

  • [X] I have searched and found no existing issue

What happened?

Importing a ~12MB .json from nYNAB fails with an unknown error. I tried the .json output resulting from the instructions for using the Terminal, and the .json output from the netifly app. Both give the same error and have the same size. The .json contains about 6 years of data, which is hard to share for obvious reasons..

What error did you receive?

An unknown error occurred while importing. Please report this as a new issue on Github.

Where are you hosting Actual?

Locally via Yarn

What browsers are you seeing the problem on?

Firefox, Other

Operating System

Mac OSX

Arnoud-B avatar Nov 24 '23 14:11 Arnoud-B

👋 Can you provide an example file to reproduce the issue? Even if it's filled with dummy data. There's not much we can do to help without being able to reproduce.

MatissJanis avatar Dec 13 '23 10:12 MatissJanis

Please find the automatically obfuscated file attached. ynab-budget-export.obfuscated.json.zip

Arnoud-B avatar Dec 19 '23 11:12 Arnoud-B

Thanks. I think the problem is with the recursive sorting solution we have. I've implemented a quick patch that falls back to unsorted list if this problem occurs. Try importing by using the demo link provided there and let me know if that fixes your problem (though I don't exactly know what other knock-on effect this unsorted-ness issue might create).

https://github.com/actualbudget/actual/pull/2104

MatissJanis avatar Dec 19 '23 19:12 MatissJanis

When testing either the obfuscated or non-obfuscated json at https://deploy-preview-2104.demo.actualbudget.org/, unfortunately, I keep getting the same (unknown) error.

Arnoud-B avatar Dec 19 '23 20:12 Arnoud-B

Your budget should have these entries. Could you please de-obfuscate them and reupload the export?

Category groups:

  • Internal Master Category
  • Credit Card Payments

Categories:

  • Income
  • Starting Balances

Payees:

  • Starting Balances

MatissJanis avatar Dec 20 '23 19:12 MatissJanis

I experienced this as well with a budget going back to 1/1/2016, but I was able to figure out the problem (at least for me) using the process of elimination. Here's what I did:

  1. Within YNAB, I did a "Fresh Start" and tested the import to Actual (which still failed).
  2. At first, I (unsuccessfully) focused on payees. I deleted many of them, and also removed any "renaming" rules (which isn't important to me because I don't import transactions anymore). As noted, this was not successful, and I still got the import error after doing this.
  3. Next, I focused (successfully) on Hidden Categories. In the "Fresh Start" file, I deleted all my hidden categories and the import WORKED. Unfortunately, I knew it wouldn't be that simple for the real budget, since you can't delete hidden categories that contain transactions.
  4. In the real budget file, I moved all the transactions in the hidden categories to a new category that I set up for this purpose (called "Hidden Categories"), and then I deleted the old hidden categories. Tested again and it worked!!!

I'm not sure what about my hidden categories caused the import to fail, but there you have it!

krelltunez avatar Jan 06 '24 16:01 krelltunez

My nYNAB budget (old data from earlier last year) export now contains one duplicate category in the hidden categories called 'Software Subscriptions' which throws this error. I didn't see this a few months ago when I first moved to actual. But saw it while doing some debugging where I wanted to import a bunch of data.

twk3 avatar Jan 06 '24 23:01 twk3

My issue very well may have been a duplicate hidden category too.

krelltunez avatar Jan 06 '24 23:01 krelltunez

OK, so I resubscribed to YNAB to try the Fresh Start approach. After removing most accounts and categories, plus all payees, and entering a fake transaction, then exporting to JSON and importing in Actual, I still get the error.

I've attached the JSON (hardly obfuscated this time but quite empty, hope that helps). budget.json

Arnoud-B avatar Jan 07 '24 16:01 Arnoud-B

I get the following error when uploading the attached budget:

failed to run import
TypeError: undefined is not an object (evaluating 'data.payees.find((payee)=>payee.name === 'Starting Balance').id')
(anonymous function) — ynab5.ts:144

Looks like @Arnoud-B's attached budget has STARTING BALANCE in uppercase, where as the corresponding block is searching for Starting Balance: https://github.com/actualbudget/actual/blob/8c43c78fc7d718d1d6a37d618d2bf568c71aa04c/packages/loot-core/src/server/importers/ynab5.ts#L140

Think it might be as simple as making the check case insensitive. Ill put up a pr

Marethyu1 avatar Jan 07 '24 22:01 Marethyu1

I have put up #2191 which I think should address the 'starting balance' issue

Marethyu1 avatar Jan 07 '24 22:01 Marethyu1

I can confirm that after replacing STARTING BALANCE with Starting Balance, the original export from YNAB is successfully imported!

Arnoud-B avatar Jan 09 '24 09:01 Arnoud-B

Importing is not working again today.

Hbicari avatar May 26 '24 10:05 Hbicari

👋 @Hbicari if you can share the file you tried to import someone might be able to take a look for you

Marethyu1 avatar May 26 '24 21:05 Marethyu1

Hello, this is the file i was trying to import. ynab-budget-export 4.json

Hbicari avatar May 30 '24 11:05 Hbicari

@Hbicari I'm able to import your file without errors on latest. What version of actual are you using?

twk3 avatar May 30 '24 14:05 twk3

24.5.0 is the version.

Hbicari avatar May 30 '24 14:05 Hbicari

Sorry i attached the wrong one. Here is the one im having issues.

Hbicari avatar May 30 '24 15:05 Hbicari

@Hbicari looks like it doesn't like that you have a category group called 'Income' - this bit in your json file

"category_groups": [
      {
        "id": "35b1d775-605c-4a5b-8c80-473a5f4de675",
        "name": "Income",
        "hidden": false,
        "deleted": false
      },

I think this is because Income is a default category group in actual by default. As a short term fix you can get around this by naming the category group something else (even just Income with a space at the end income , that will enable you to import your budget. (just edit the json file and try reupload).

Longer term something should be done to handle imports that have a category group set as income, this can probably be raised as a bug

Marethyu1 avatar May 31 '24 01:05 Marethyu1

That Worked, thank you for the help.

Hbicari avatar May 31 '24 08:05 Hbicari