I have been trying to use KMM 5.2.1 (stable of dev). I am using the AppImage version. When I open the database I get an error dialog box saying:
Cannot open file as requested.
Details:
Corrupted data: transaction ‘’, split ‘S0001’ references unknown account id ‘A000562’ /builds/office/kmymoney/src/kmymoney/plugins/xml/mymoneyxmlreader.cpp:771
Can anybody point me to how I can find the corrupted transaction or what to do? I can use the I can use the .kmy file on the 5.1.3 AppImage version without a problem and it opens just fine.
I am on Kubuntu 24.04 if that matters.
Thank you.
Do you really mean database, or is it just that 5.1.3 will read your kmy file but 5.2.1 complains? I would expect both versions to complain about a split referencing a non-existing account. To identify, you can copy the kmy file to file.xml.gz and gunzip it, producing an xml file. If you grep for A000562, hopefully the only result is that split. The surrounding lines will identify the transaction.
5.1.3 will read the kmy file without complaining and I have been using it for many years. 5.2.1 will complain and won’t open the file.
I started out porting my Microsoft Money file to Kmymoney some time in 2009 - might be from that still?
I will try looking at the xml file tonight. Thank you for the suggestion!
I found the transactions searching for the account ID and deleted the handful of them. When trying to open the kmy file, it flagged the next transaction that it had trouble with having a different account ID. The transactions were all investment transactions over a wide data range. Not sure what is wrong with my file and I am not sure what to do next. I guess I will just continue to use 5.1.3 for now.
The other thing to note is that I was able to use my file with KMM 5.2.1 using an older version of the AppImage (kmymoney-5.2-4613-linux-gcc-x86_64). Something must have changed recently that it now flags this error.
Yes, more checks have been added to find those cases. That is why they show up now.
What is the output of the following command?
zgrep 'id="A000562"' your-data-file.kmy | grep '<ACCOUNT'
Please replace your-data-file.kmy with your own file name and paste the output here. Replace private data with placeholders. Thank you.
Thank you for your reply. I used the command on my kmy file and did not get any output.
When I look at the transaction that uses A000562 it looks like a belongs to an investment dividend transaction of a security that had been closed in an investment account that is open.
When I look at that transaction in a version of KMM that opens the file it shows up and looks fine.
Is there anything else I can try or do?
That means, that the account object is not present (anymore) in your data file which causes the inconsistency but it is still referenced. You can see this using the following command:
zgrep 'id="A000562"' your-data-file.kmy
Once you try to save that transaction KMyMoney should fail to do so and complain about a missing account, even in the version that can read it.
You may try to ‘repair’ the transactions in the version that works. Edit the transaction and assign all categories afresh. If that does not work for whatever reason, you can try to remove the split that references the transaction directly in the data file and edit the transaction then. Repeat for any other account that is missing.
Another solution may be to ‘patch’ the file and change A000562 to a valid id. That requires some knowledge about the internals, so I would not suggest to follow that route in the first place. The most important thing is that you use the same type of account. Since A000562 does not exist (anymore) this might become a bit tricky and cause other headaches down the line.
Summary: I have no idea how you ended up in this scenario, because KMyMoney refuses to delete accounts that are still referenced for a long time.
Thank you for all your suggestions @ipwizard, I really appreciate it.
I am going to try some of these things. As stated before I have tried to just plain delete the transactions of that account ID and then it complained about the next one.
The version that I am using can safe after I make edits and I have the feeling I have had this for a lot of time.
I have my financial life for the last 28 year in the file. I will experiment on what to do here.
Again, I really appreciate that you spent the time helping me. Kmymoney is awesome!
It seemed that the account id referred to a Payee for some investment transactions that were created when those entries were downloaded from the bank. I ended up deleting a Payee and replacing that with a new one I created. It was a bit more difficult on some other transactions. There I did a find & replace of the account id numbers with a known good one.
I had to do this for about 8 different account IDs and maybe 20 to 30 transactions total. I don’t really have any idea how this happened and hopefully I didn’t create more problems for the future. The file now opens again without an error message.
Thank you again for all the help here and thank you for the error message flagging the troubled account ID.
id="A000562refers not to any Payee but to either a regular (asset or liability) account or to a category (income or expense account) but it is likely both the payee and category may have been created at import time. For one of those problem transactions (eventually all of them) if you can confirm that both the Payee and Category refer to existing entries in your data then the data should be acceptable to the new version of KMyMoney.
1 Like
Hello -
I am having this same issue. I am upgrading from 5.1.2 to 5.2 using AppImage kmymoney-5.2-5024-linux-gcc-x86_64.AppImage. This is on a Debian machine. In an attempt to determine what was happening, I tried and successfully was able to open the file fine in 5.1.3. In 5.2, however, it shows a corrupted file and gives me account number, like the poster above. I looked in the XML file, found the transaction (it was only referenced once), which was credit card transaction from 2015, removed the memo, and that satisfied that need. Then, it showed another account number, which appears 63 times in the XML.
Does anyone have any suggestions for how do deal with this?
After further research, I was able to edit the file and open it. I didn’t delete the original post because I wanted the developers to have this info.
Thanks!
Can you please share some details on what you have done to solve the issue? Thanks.
Sure! Thanks for asking and sorry for not doing that before. I wanted to send a quick reply before someone started spending time on my issue and regret not giving more info.
First, I saved the file in the .xml format and then searched for the problematic numbers. I determined whether it was an expense or income transaction. Mine were all expense transactions. I then found an expense account number that was attached to an expense category and substituted that (with find and replace) for the problematic ones. Mine was less complicated than the OP’s because I think theirs was an investment transaction. Mine were over 10 years old and nontax categories, so I just substituted groceries. There were only a few unique numbers that needed correcting before I was able to open it.
I think this was a similar solution (if not the same) as the OPs…I just had trouble understanding it until I actually did it.
Let me know if you have any questions or need more clarification.
1 Like