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

Error: Failed to load latest transactions from YNAB Caused by: YNAB API request error Caused by: unknown variant `, expected one of red, orange, yellow, green, blue, purple` at line 1 column 169 #17

Closed
wizonesolutions opened this issue Dec 15, 2019 · 4 comments

Comments

@wizonesolutions
Copy link

fca4ynab is currently stuck after I unflagged a few transactions. I had green flags on them before, and then I removed them. I specifically used Toolkit for YNAB's "Remove Flags" context menu feature. Toolkit for YNAB is a client-side tool, and I don't think it should be able to put YNAB into an inconsistent state, but I'm not sure. Maybe I should try re-flagging them, running the tool, and unflagging them by hand again or something?

But I'm hoping it can just catch the error and handle it somehow.

Error message:

 !  ~/S/fca4ynab  env RUST_LOG="fca4ynab=debug" ./fca4ynab --yes --auto-approve-transactions=true --auto-approve-adjustments=true
[2019-12-15T20:59:38Z DEBUG fca4ynab::cli] Using configuration file path: "/Users/kevin/Library/Preferences/io.borsboom.fca4ynab/env"
[2019-12-15T20:59:38Z DEBUG fca4ynab::database] Using database file: /Users/kevin/Library/Application Support/io.borsboom.fca4ynab/data.sqlite3
Loading latest transactions from YNAB...
Error: Failed to load latest transactions from YNAB
Caused by: YNAB API request error
Caused by: unknown variant ``, expected one of `red`, `orange`, `yellow`, `green`, `blue`, `purple` at line 1 column 169
@borsboom
Copy link
Owner

Thanks for the detailed report. I've been able to reproduce this, but only using Toolkit for YNAB. Removing flags using the standard (non-toolkit) UI seems to work fine.

According to the YNAB API's Swagger spec, an empty string for the flag colour field is illegal. The flag field should either be null or one of the flag colour values. My guess is that the Toolkit is directly setting to to the empty string in the browser's memory, and then when that gets synced the server isn't actually checking it carefully enough (probably using a dynamically typed programming language) and just putting it into their content store as-is.

I'll special-case the parser (which is auto-generated from the Swagger spec) to handle an empty string here.

In the mean-time, you can work around this problem by setting a flag again and then using the standard UI to clear them (one at a time, unfortunately).

@wizonesolutions
Copy link
Author

wizonesolutions commented Dec 15, 2019 via email

@borsboom
Copy link
Owner

I've pushed PR #18 to handle this. Once the artifacts have finished building, you can try it out by downloading the artifacts.

@borsboom
Copy link
Owner

Released in v0.1.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants