Bug 380961

Summary: Cannot load file . Reason: File was not parsable!
Product: [Applications] kmymoney Reporter: Mike Jenck <mpjenck>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED NOT A BUG    
Severity: crash CC: Muenster_westf, ostroffjh, ralf.habacker
Priority: NOR    
Version: 4.7.2   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: Unexpected end of file

Description Mike Jenck 2017-06-08 07:22:10 UTC
When attempting to open my kmymoney file I received the following error.  

Cannot load file k:/KMyMoney_2012.kmy. Reason: File was not parsable!  

The next message is:

Cannot open file as requested.  Error was: Currency 'USD' not found.

Uncaught error.  Please report to the developers
Details
Currency 'USD' not found. in file e:\r\build\extragear\kmymoney-4.6.1-20110918\work\kmymoney-4.7.2\kmymoney\mymoney\mymoneyfile.cpp line 2,596

If this is not recoverable then I will have lost 8 months of data :(  The last thing I remember doing was creating a custom report that worked fine.  When I tried to open up the file it gave the following errors.  If there is a way to fix the data file I will do what I can otherwise I need to rebuild the last 8 months of data.
Comment 1 Jack 2017-06-08 15:56:38 UTC
First, you should upgrade to 4.8.0, which has been available almost a year.
Second, do you have any backups?
More directly to your problem, a .kmy file is just a gzipped x.xml file.  If you make a copy of your file to one called file.xml.gz, you should be able to gunzip it.  The resulting xml file is plain text, so you should be able to look at it in a text editor.  This will at least confirm that the compression was not the problem.  Then we can dig into what is wrong with the file, and whether or not it can be easily repaired.
The currency not found issue seems odd, because it implies that KMM was able to read the file, unless perhaps it was truncated, which doesn't seem likely.
Post back with the results of checking that the xml file is readable.
Comment 2 Mike Jenck 2017-06-08 17:54:20 UTC
I will check this when I get home.  Would 7zip be able to unzip the file?
Comment 3 Jack 2017-06-08 19:34:53 UTC
On my Win7 machine, yes, 7zip will open a .gz file.
Comment 4 Mike Jenck 2017-06-08 20:17:36 UTC
Created attachment 105998 [details]
Unexpected end of file
Comment 5 Jack 2017-06-08 21:12:10 UTC
So it seems the file itself has been damaged or truncated.  Figuring out how that happened will not help recover it, but it might point to something in your system which is failing.  

Have you always just saved the file and then opened it in the same location, or have you copied it anywhere?  Is it stored on a local hard drive, or a network shared drive?  If local, can you run SMART diagnostics on it?  While not likely relevant, have you run a full virus scan and scan for any malware?  

Can you think of anything which changed on your PC since you last successfully opened/saved the file?
Comment 6 Mike Jenck 2017-06-08 21:21:31 UTC
(In reply to Jack from comment #5)
> So it seems the file itself has been damaged or truncated.  Figuring out how
> that happened will not help recover it, but it might point to something in
> your system which is failing.  
> 
> Have you always just saved the file and then opened it in the same location,
> or have you copied it anywhere?  Is it stored on a local hard drive, or a
> network shared drive?  If local, can you run SMART diagnostics on it?  While
> not likely relevant, have you run a full virus scan and scan for any
> malware?  
> 
> Can you think of anything which changed on your PC since you last
> successfully opened/saved the file?


It has been in the same location for 5 years.  The only thing I can think of is I just had a blue screen of death - and KMyMoney was open.  I hope it wasn't saving at that time.  It's stored on a local hard disc drive (4TB) in an encrypted container.  It seems to not have any more data as the file is 32 kb and the backup one was 616 kb.  I was able to merge the two together and get a file that is 620 kb
Comment 7 Ralf Habacker 2017-07-31 11:43:39 UTC
This is a file corruption issue, not an issue of the kmymoney application and seems to be solved by restoring a backup file.