Bug 513478 - Unable to open .kmdb files on latest stable builds
Summary: Unable to open .kmdb files on latest stable builds
Status: NEEDSINFO WAITINGFORINFO
Alias: None
Product: kmymoney
Classification: Applications
Component: database (other bugs)
Version First Reported In: 5.2.1
Platform: Microsoft Windows Microsoft Windows
: NOR critical
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-17 13:25 UTC by Lawrence Wright
Modified: 2025-12-20 08:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Screenshot of "Cannot open file as requested" error dialog (27.93 KB, image/png)
2025-12-17 13:25 UTC, Lawrence Wright
Details
CLI output of execution (13.08 KB, text/plain)
2025-12-17 17:06 UTC, Lawrence Wright
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lawrence Wright 2025-12-17 13:25:08 UTC
Created attachment 187735 [details]
Screenshot of "Cannot open file as requested" error dialog

SUMMARY

Just updated from 5.2.1-9e2a207 to 5.2.1-db083e7 and discovered that I'm unable to open .kmdb databases any more. I get an error dialog "Cannot open file as requested". 

I've also tried 5.2.1-2b46853 which has the same problem.

STEPS TO REPRODUCE
1. On a Windows system....
2. Install 5.2.1-db083e7 (or 5.2.1-2b46853 - I've not tried other builds, they may be affected too)
3. Try and open a .kmdb file either through "Open Recent" or "Open Database" 

OBSERVED RESULT

Error dialog "Cannot open file as requested" appears with detail as follows:
Unknown account C:
\builds\office\kmymoney\src\kmymoney\mymoney\mymoneyfile.cpp:1666

(see attached image)

EXPECTED RESULT

Database opens correctly

SOFTWARE/OS VERSIONS
Windows: 11 25H2

ADDITIONAL INFORMATION
Doesn't seem to matter where the file is located on the drive - e.g. I moved from my Onedrive synched Documents folder to a folder c:\test and got the same error
Comment 1 Jack 2025-12-17 16:08:54 UTC
Can you launch the program from a command line to see if any additional information is written to console output?
What type of database is a .kmdb file?
The message seems odd in that it is not clear if that is the unknown account or just the program file where the unknown account is detected.
Comment 2 Thomas Baumgart 2025-12-17 16:52:49 UTC
That is bizarre: it's try to find the data of an unknown account. The CLI output may help to identify where and why this happens. Do you have backups that still work?
Comment 3 Lawrence Wright 2025-12-17 17:05:41 UTC
(In reply to Thomas Baumgart from comment #2)
> That is bizarre: it's try to find the data of an unknown account. The CLI
> output may help to identify where and why this happens. Do you have backups
> that still work?

CLI output will attached shortly. If I downgrade to 5.2.1-9e2a207 everything works fine again so I'm not stuck without access to my data, and I have backups of the kmdb. The final line of CLI output appears just before the error dialog is displayed - nothing further printed after clicking OK to get rid of the error.

Given the versions that work / don't work, the final line on the CLI, and the error message detail, could this be due to commit 75716af3 ?
Comment 4 Lawrence Wright 2025-12-17 17:06:10 UTC
Created attachment 187746 [details]
CLI output of execution
Comment 5 Lawrence Wright 2025-12-17 17:06:57 UTC
(In reply to Jack from comment #1)
> Can you launch the program from a command line to see if any additional
> information is written to console output?
> What type of database is a .kmdb file?
> The message seems odd in that it is not clear if that is the unknown account
> or just the program file where the unknown account is detected.

CLI output attached, .kmdb is (as far as I'm aware!) an SQLite format database.
Comment 6 Lawrence Wright 2025-12-17 17:12:37 UTC
Note that if I create a completely new book and save it as a SQLite database (new .kmdb file), close KMyMoney, then start KMyMoney again, the test database opens with no issue. Presumably it is something to do with an upgrade being done on my existing file on first open? (which suggests a potential workaround of saving as XML in 5.2.1-9e2a207, upgrading to 5.2.1-db083e7 and then re-saving as SQLite format - however that won't help with me helping test any fix to the bug, so I won't do that for now :)
Comment 7 Thomas Baumgart 2025-12-17 17:17:44 UTC
> Given the versions that work / don't work, the final line on the CLI,
> and the error message detail, could this be due to commit 75716af3 ?

That could well be the case. If the problem is with you data (which I think has a very large probability) you can try the following:

a) go back to 5.2.1-9e2a207
b) save your db as test.xml
c) upgrade to db083e7
d) load the test.xml file

If the data is the problem it may fail also at the same spot. Meanwhile, I am working on the next steps.
Comment 8 Lawrence Wright 2025-12-17 17:25:21 UTC
(In reply to Thomas Baumgart from comment #7)
> > Given the versions that work / don't work, the final line on the CLI,
> > and the error message detail, could this be due to commit 75716af3 ?
> 
> That could well be the case. If the problem is with you data (which I think
> has a very large probability) you can try the following:
> 
> a) go back to 5.2.1-9e2a207
> b) save your db as test.xml
> c) upgrade to db083e7
> d) load the test.xml file
> 
> If the data is the problem it may fail also at the same spot. Meanwhile, I
> am working on the next steps.

Just tried it and db083e7 was successfully able to open the file! Output below:

[..snip..]
Open file QUrl("file:///C:/Users/username/Documents/test.xml")
Model for parameters loaded with 1 items
Model for "I" loaded with 23 items in 0 ms
Model for "P" loaded with 3160 items in 18 ms
Model for "G" loaded with 3 items in 0 ms
Start verifying account hierarchy
End verifying account hierarchy
Model for accounts loaded with 203 items in 2 ms
Model for "T" loaded with 31540 items in 136 ms
Model for parameters loaded with 2 items
Model for schedules loaded with 35 items in 0 ms
Model for "E" loaded with 18 items in 0 ms
Model for currencies loaded with 3 items
Model for prices loaded with 4114 items in 6 ms
Model for "R" loaded with 29 items in 0 ms
testing fileFixVersion 5 < 10
1 transaction(s) fixed in MyMoneyFile::Private::fixFile_5
testing fileFixVersion 6 < 10
29 reports(s) fixed in MyMoneyFile::Private::fixFile_6
testing fileFixVersion 7 < 10
2 reports(s) fixed in MyMoneyFile::Private::fixFile_7
testing fileFixVersion 8 < 10
testing fileFixVersion 9 < 10
0 schedule(s) fixed in MyMoneyFile::Private::fixFile_9
Start calculating balances:
[..snip..]
Comment 9 Thomas Baumgart 2025-12-17 17:43:54 UTC
Do you see any empty column accountName when you run the following SQL statement on  your database?

SELECT kmmSchedules.id, kmmSplits.accountId, kmmAccounts.accountName
FROM kmmSchedules
JOIN kmmSplits ON kmmSchedules.id = kmmSplits.transactionId
JOIN kmmAccounts ON kmmSplits.accountId = kmmAccounts.id;
Comment 10 Lawrence Wright 2025-12-17 21:06:41 UTC
(In reply to Thomas Baumgart from comment #9)
> Do you see any empty column accountName when you run the following SQL
> statement on  your database?
> 
> SELECT kmmSchedules.id, kmmSplits.accountId, kmmAccounts.accountName
> FROM kmmSchedules
> JOIN kmmSplits ON kmmSchedules.id = kmmSplits.transactionId
> JOIN kmmAccounts ON kmmSplits.accountId = kmmAccounts.id;

I've just run that query and all rows have text present for accountName - there are no blanks.

Thanks!
Comment 11 Thomas Baumgart 2025-12-20 08:55:57 UTC
Thanks for the info. I wonder, if loading as XML fixed the problem (a few fixes are visible in the console output you provided). Can you try to take the test.xml, load it into the latest KMyMoney version and save it as database again. Then comparing the database contents (old and new) may provide hints what the original problem is.