This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Node was not TRANSACTION

Tags: None
(comma "," separated)
pkrauer
Registered Member
Posts
12
Karma
0

Node was not TRANSACTION

Mon Dec 16, 2019 7:19 pm
Hi all,
I'm using KMyMoney 5.0.0. I'm trying to delete a transaction (which I imported via qif File) but get the following error and the application crashes:
Unable to delete transaction(s): Node was not TRANSACTION, thrown in /build/kmymoney-8Tb1zm/kmymoney-5.0.1/kmymoney/mymoney/mymoneytransaction.cpp:53

The error is reproducable by trying to delete one particular transaction. I can delete other transactions without any issue.

Can anyone help?

Best regards,
Patrick
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION

Mon Dec 16, 2019 8:06 pm
That is very strange and you are the first one reporting it. Can you try to duplicate the problem using an anonymized version of the file? See the online manual for more information how to create such a file. If there are any questions, please let us know. Send the file to kmymoney-devel@kde.org


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
pkrauer
Registered Member
Posts
12
Karma
0

Re: Node was not TRANSACTION

Wed Dec 18, 2019 8:57 pm
Hi ipwizard,
thank you for your reply. Unfortunately, I cannot save an anonym file. I get another Error there:
Unable to write changes to '<path_to_file>.anon.xml'

Any idea?

Best regards,
Patrick
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION

Thu Dec 19, 2019 7:04 am
OK, can you upgrade to a newer version? The latest stable version is 5.0.7 and the problem (at least writing the anon file) should be fixed in the meantime. Don't know about your initial problem. We will see.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
pkrauer
Registered Member
Posts
12
Karma
0

Re: Node was not TRANSACTION

Thu Dec 19, 2019 7:12 pm
I'm on ubuntu 18.04 LTS and there I can't find kmymoney 5.0.7 :-(

What is the easiest way to upgrade to the latest version without getting a lot of dependency issues?

Many thanks for your help!
Patrick
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION

Fri Dec 20, 2019 8:09 am
You can try to use the AppImage version.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
pkrauer
Registered Member
Posts
12
Karma
0

Re: Node was not TRANSACTION

Fri Dec 20, 2019 7:59 pm
Hey ipwizard,
many thanks for your help.
I now used the AppImage (Version 5.0.7-de6d242) and cannot open my file. I get the following error:
File was not parsable! /home/appimage/workspace/KMyMoney_Stable_Appimage_Build/kmymoney/kmymoney/plugins/xml/mymoneystoragexml.cpp:1396

"Exception while creating a TRANSACTION element: Node was not TRANSACTION /home/appimage/workspace/KMyMoney_Stable_Appimage_Build/kmymoney/kmymoney/plugins/xml/mymoneystoragexml.cpp:532"

Does this say anything to you?

Cheers,
Patrick
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION

Sat Dec 21, 2019 8:34 am
Patrick, yes it does. Your file seems to be corrupted. Howto fix it? Kind of hard to say without knowing details. OK, let's give it a try nevertheless. I suggest you read all of this before you start.
  • First you need to make a backup copy of your file. Store it under a different name or in a different directory.
  • Check if you have backup copies made by KMyMoney. They are called like your data file name with a suffix of .#~ where # is a digit/number providing the age of the file. 1 is the newest, 2 the one before and so on. Each time you press Save KMyMoney renames 1 -> 2, 2 -> 3, etc. and creates a new number 1. The oldest gets dropped. See autosave options, number of backups in the manual. Example: my filename is ipwizard.kmy and the newest backup is called ipwizard.kmy.1~
  • In case you do have such backup files
    • Make a backup of them (e.g. copy in a different directory, you never know if you need them in the future)
    • try to load them from newest to oldest and see if you find one that does not fail. You can provide the filename as argument to KMyMoney on the command line. Use the one you can load and copy it to your original name and continue to work. Check what is missing and enter the missing data.
    • If too much data is missing, try to continue with the next steps
  • In case you don't have such backup files:
    • Convert the file into a human readable format using the following commands (I am using my data file name ipwizard.kmy as example. Replace it with yours.
      • mv ipwizard.kmy ipwizard.kmy.gz
      • gunzip ipwizard.kmy.gz
    • Run xmllint ipwizard.kmy and check if that identifies any problem. You may have to install the tool xmllint first.
    • In case it shows problems, use an editor to correct them. Make sure to have that backup of step 1 above :)
    • In case it does not show problems, use the editor to look at the file. Look for the line <TRANSACTIONS count="####">. Within the following lines, only new nodes with type <TRANSACTION attr= ...> are allowed. Anything else will result in the error message you get. Search for the offending part.
    • ???? What to do next heavily depends on what you find, so I can't really provide advise at this point in time. Report it here. Replace any personal information with placeholders.
    • In case you understand the structure of the file, correct it using the editor and save the file. There is no need to convert it back to its gzipped format as KMyMoney does that when saving the next time.
Depending on your background and knowledge this may be an easy trip or a harder one. Since you have those backups you can always repeat the steps. We'll see.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
pkrauer
Registered Member
Posts
12
Karma
0

Re: Node was not TRANSACTION

Sat Dec 21, 2019 10:55 am
Hey ipwizard,
wow, cool, I can open the XML file :-) Didn't know that it is just gzipped, I thought it is a proprietary binary format.

I can see two potential issues:
- <TRANSACTIONS count=11546> but when counting the <TRANSACTION ...> tags, I get 11565. Do I need to change the count to 11565?
- Within the <PAIR> tag, I can find TRANSACTION as a text in the value attribute. Could this be an issue?

Many many thanks for your support!

Cheers,
Patrick
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION

Sat Dec 21, 2019 1:18 pm
Regarding the supported file formats see the manual or maybe a translated version ;) My favorite is the GPG version.

No need to update the count. KMyMoney will take care of it. Given the number, it might be a bit tricky to find the culprit. The ones in the PAIR element seem to be matched transactions. They don't hurt. Another spot where the cause of the error message could be is in the <SCHEDULES ...> section. The schedules also contain a transaction. Anything at the level of a transaction that does not look like one?

Here's a small script that extracts the structural information and hides all private information for further tests:

Code: Select all
#!/usr/bin/perl

while(<>) {
    # print $_;
    if ($_ =~ /^(\s*<[A-Za-z0-9-]+)[^>]*\/>/) {
        print "$1/>\n";
    } elsif ($_ =~ /^(\s*<[A-Za-z0-9-]+)[^>]*>/) {
        print "$1>\n";
    } elsif ($_ =~ /^(\s*<\/[A-Za-z0-9-]+>)/) {
        print "$1\n";
    } elsif ($_ =~ /^(<[\!|\?][^>]*>)/) {
        print "$1\n";
    }
}

Save that script into a file called e.g. kmm-struct.pl and make it executable with chmod +x kmm-struct.pl. Then run ./kmm-struct.pl < ipwizard.kmy > ipwizard.txt where ipwizard.kmy is the gunzipped version. Scan ipwizard.txt visually and see if you can spot a node that should be a TRANSACTION but is not.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
pkrauer
Registered Member
Posts
12
Karma
0

Re: Node was not TRANSACTION

Tue Dec 24, 2019 9:57 am
Hi ipwizard,
thanks for the script. I was looking closer into the xml but didn't find the issue. Then I started trial and error (I removed the scheduled transactions first, then transactions of particular months etc). Now I found the transaction which causes the KMymoney crash :)

The issue is the value in kmm-matched-tx. Funnily enough, I have this tag only 7 times in all of my transactions but have much more matched transactions.
The value looks like this:
Code: Select all
<PAIR key="kmm-matched-tx" value="&amp;lt;!DOCTYPE MATCH>&#xa;&amp;lt;CONTAINER>&#xa; &amp;lt;TRANSACTION postdate=&quot;2019-06-25&quot; commodity=&quot;CHF&quot; memo=&quot;&amp;quot;GUTSCHRIFT VON FREMDBANK AUFTRAGGEBER: MYNAMEANDADDRESS MITTEILUNGEN: Postkonto &amp;lt;REMITTANCEINFORMATION_LINE4 REFERENZEN: NOTPROVIDED 917617921800001 190625CH04DTRG1Y&amp;quot;&quot; id=&quot;&quot; entrydate=&quot;2019-11-21&quot;>&#xa;  &amp;lt;SPLITS>&#xa;   &amp;lt;SPLIT payee=&quot;&quot; reconcileflag=&quot;0&quot; shares=&quot;1001/1&quot; reconciledate=&quot;&quot; action=&quot;&quot; bankid=&quot;2019-06-25-27c1f90-1&quot; account=&quot;A000014&quot; number=&quot;&quot; value=&quot;1001/1&quot; memo=&quot;&amp;quot;GUTSCHRIFT VON FREMDBANK AUFTRAGGEBER: MYNAMEANDADDRESS MITTEILUNGEN: Postkonto &amp;lt;REMITTANCEINFORMATION_LINE4 REFERENZEN: NOTPROVIDED 917617921800001 190625CH04DTRG1Y&amp;quot;&quot; id=&quot;S0001&quot;/>&#xa;  &amp;lt;/SPLITS>&#xa;  &amp;lt;KEYVALUEPAIRS>&#xa;   &amp;lt;PAIR key=&quot;Imported&quot; value=&quot;true&quot;/>&#xa;  &amp;lt;/KEYVALUEPAIRS>&#xa; &amp;lt;/TRANSACTION>&#xa;&amp;lt;/CONTAINER>&#xa;"/>


Do you have any clue what is wrong in here?

Best regards and merry x-mas
Patrick
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION  Topic is solved

Tue Dec 24, 2019 11:26 am
Oh, this is weird. The problem is in the text
Code: Select all
Postkonto &amp;lt;REMITTANCEINFORMATION_LINE4
If you remove the &amp;lt; part in front of the "REMITTANCE" the file loads without a problem (it is contained twice, you have to remove both). I wonder how the character '<' (it's what the &amp;lt; stands for) came into the text in the first place.

Guess I have to come up with a testcase for this escaping/unescaping one.

Merry Christmas in direction of the Alps too.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
pkrauer
Registered Member
Posts
12
Karma
0

Re: Node was not TRANSACTION

Tue Dec 24, 2019 2:57 pm
Many thanks ipwizard, I'm so happy that I can now continue to do my bookings (even if that's not my favorite work).

Btw: The transaction which caused the issue was imported. Would you like me to try to reproduce it?

All the best!
Patrick
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION

Tue Dec 24, 2019 3:23 pm
pkrauer wrote:Btw: The transaction which caused the issue was imported. Would you like me to try to reproduce it?

If you can do that it would be great. I am interested in the import log. You can turn that on using Settings/Configure KMyMoney/General/Support. The kmm-statement-<date><time>.txt file is what you are looking for. Replace anything private in that file but leave that character untouched in the memo attribute. Thanks for your support.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: Node was not TRANSACTION

Wed Dec 25, 2019 9:48 am
I opened a bug report for this and work on a fix :)


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar