Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Import from nYNAB fails with unknown error #1968

Closed
1 task done
Arnoud-B opened this issue Nov 24, 2023 · 20 comments · Fixed by #2191
Closed
1 task done

[Bug]: Import from nYNAB fails with unknown error #1968

Arnoud-B opened this issue Nov 24, 2023 · 20 comments · Fixed by #2191
Labels
bug Something isn't working needs info We need more information from the OP before continuing

Comments

@Arnoud-B
Copy link

Verified issue does not already exist?

  • 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 Arnoud-B added the bug Something isn't working label Nov 24, 2023
@MatissJanis
Copy link
Member

👋 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 MatissJanis added the needs info We need more information from the OP before continuing label Dec 13, 2023
@Arnoud-B
Copy link
Author

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

@MatissJanis
Copy link
Member

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).

#2104

@Arnoud-B
Copy link
Author

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.

@MatissJanis
Copy link
Member

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

@krelltunez
Copy link

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!

@twk3
Copy link
Contributor

twk3 commented Jan 6, 2024

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.

@krelltunez
Copy link

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

@Arnoud-B
Copy link
Author

Arnoud-B commented Jan 7, 2024

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

@Marethyu1
Copy link
Contributor

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:

payee => payee.name === 'Starting Balance',

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

@Marethyu1
Copy link
Contributor

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

@youngcw youngcw linked a pull request Jan 7, 2024 that will close this issue
@Arnoud-B
Copy link
Author

Arnoud-B commented Jan 9, 2024

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

joel-jeremy added a commit that referenced this issue Jan 12, 2024
* Allow case insensitive ynab5 import for special 'starting balance' payee

* set upcoming release number to related github issue

* extract string comparison into separate function

and reuse when checking starting balance/s on ynab4 import

* make all category group checks case insensitive

when importing from ynab5 to make the check strategy consistent when importing from ynab5

* extract findById into sreusable function

to 'simplify' usage

* Add null check

Co-authored-by: Joel Jeremy Marquez <[email protected]>

---------

Co-authored-by: Joel Jeremy Marquez <[email protected]>
FlorianLang06 pushed a commit to FlorianLang06/actual that referenced this issue Mar 7, 2024
…error (actualbudget#2191)

* Allow case insensitive ynab5 import for special 'starting balance' payee

* set upcoming release number to related github issue

* extract string comparison into separate function

and reuse when checking starting balance/s on ynab4 import

* make all category group checks case insensitive

when importing from ynab5 to make the check strategy consistent when importing from ynab5

* extract findById into sreusable function

to 'simplify' usage

* Add null check

Co-authored-by: Joel Jeremy Marquez <[email protected]>

---------

Co-authored-by: Joel Jeremy Marquez <[email protected]>
@Hbicari
Copy link

Hbicari commented May 26, 2024

Importing is not working again today.

@Marethyu1
Copy link
Contributor

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

@Hbicari
Copy link

Hbicari commented May 30, 2024

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

@twk3
Copy link
Contributor

twk3 commented May 30, 2024

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

@Hbicari
Copy link

Hbicari commented May 30, 2024

24.5.0 is the version.

@Hbicari
Copy link

Hbicari commented May 30, 2024

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

@Marethyu1
Copy link
Contributor

Marethyu1 commented May 31, 2024

@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

@Hbicari
Copy link

Hbicari commented May 31, 2024

That Worked, thank you for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs info We need more information from the OP before continuing
Projects
None yet
6 participants