https://bugs.kde.org/show_bug.cgi?id=517246
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |5.2 Summary|Failed to open database |KMyMoney 5.2.2 fails to |kmymoney version 5.1.3 to |reliably migrate/reopen |5.2.2. |legacy 5.1.3 XML files | |using `AStd::Equity` splits | |and old-style IDs such as | |`8-account` / | |`326-category` Keywords| |needs_verification --- Comment #8 from [email protected] --- I relied heavily on chatgpt to support my report of this blocking "bug" for those wanting to use future versions of kmymoney. My fully functional kmymoney file for version 5.1.3 is attached (anonymized), along with other files. Thanks again for your patience :) # KMyMoney 5.2.2 migration bug report (detailed) ## Title KMyMoney 5.2.2 fails to reliably migrate/reopen legacy 5.1.3 XML files using `AStd::Equity` splits and old-style IDs such as `8-account` / `326-category` ## Product / Version - Product: KMyMoney - Source file created/used successfully with: 5.1.3 - Target version showing the problem: 5.2.2 - Platform: Windows 11 ## Summary A legacy KMyMoney XML file that opens and passes consistency checks in 5.1.3 cannot be migrated reliably to 5.2.2. There appear to be **two related compatibility issues**: 1. **Opening in 5.2.2 initially fails** because some transactions reference the standard account `AStd::Equity` directly in splits. 2. After manually patching those splits to a real equity account (for example `A000002`, “Opening Balances”), the file can open in 5.2.2, but **after saving and reopening**, 5.2.2 fails again with errors on **legacy identifiers** such as: - `8-account` - `9-account` - `326-category` - etc. The problem also appears after saving to SQLite: the file/database may open during the same session, but reopening later fails with `Unknown account`. ## Initial state in 5.1.3 The original file behaves normally in KMyMoney 5.1.3: - opens successfully - built-in consistency check reports data is consistent - no visible corruption from the point of view of 5.1.3 The file contains older-style internal IDs such as: - `8-account` - `9-account` - `4-account` - `323-category` - `326-category` It also contains standard account roots such as: - `AStd::Asset` - `AStd::Liability` - `AStd::Expense` - `AStd::Income` - `AStd::Equity` ## Step-by-step reproduction history ### Case 1: open original 5.1.3 XML in 5.2.2 Attempt to open the original XML file from 5.1.3 in KMyMoney 5.2.2. ### Result 5.2.2 refuses to open the file with: ```text Corrupted data: transaction 'T000000000000000248', split 'S0002' references unknown account id 'AStd::Equity' C:\builds\office\kmymoney\src\kmymoney\plugins\xml\mymoneyxmlreader.cpp:775 ``` ## Investigation The file contains transactions whose splits directly reference: ```xml account="AStd::Equity" ``` Example pattern: ```xml <SPLIT ... account="AStd::Equity" ... /> ``` The file also contains a real child account under `AStd::Equity`, for example: ```xml <ACCOUNT id="A000002" name="Opening Balances" parentaccount="AStd::Equity" ... /> ``` ## Manual workaround applied Only the split references were changed: - from `account="AStd::Equity"` - to `account="A000002"` Important: the standard account definition itself was **not** changed, and `parentaccount="AStd::Equity"` was left untouched. After this patch, the XML opens successfully in 5.2.2. ## Case 2: save from 5.2.2, then reopen After the patched XML opens successfully in 5.2.2: - save file - close KMyMoney - reopen saved file ### Result Reopen fails with: ```text Corrupted data: transaction 'T000000000000000001', split 'S0001' references unknown account id '8-account' C:\builds\office\kmymoney\src\kmymoney\plugins\xml\mymoneyxmlreader.cpp:775 ``` This suggests that 5.2.2 does not reliably support or migrate old-style identifiers such as `8-account` and `326-category` when reading/writing legacy data. ## XML structure observations The XML structure itself appears internally coherent: - account `8-account` exists in `<ACCOUNTS>` - `8-account` is listed under `AStd::Asset` - transaction `T000000000000000001` references `account="8-account"` - corresponding categories like `326-category` also exist in `<ACCOUNTS>` Example excerpts: ```xml <ACCOUNT opened="2012-12-31" id="8-account" ... name="..." parentaccount="AStd::Asset"> ``` ```xml <ACCOUNT opened="" id="AStd::Asset" ...> <SUBACCOUNTS> <SUBACCOUNT id="8-account"/> ... </SUBACCOUNTS> </ACCOUNT> ``` ```xml <TRANSACTION id="T000000000000000001" ...> <SPLITS> <SPLIT id="S0001" ... account="8-account" ... /> <SPLIT id="S0002" ... account="326-category" ... /> </SPLITS> </TRANSACTION> ``` So from the file content, the account is present and referenced consistently, yet 5.2.2 later reports it as unknown. ## Case 3: SQLite path A second migration attempt used SQLite from 5.2.2: 1. Open patched XML in 5.2.2 2. Save as SQLite database 3. Reopen the database ### Result The database may work in-session after fixes, but reopening later fails with: ```text Unknown account C:\builds\office\kmymoney\src\kmymoney\mymoney\mymoneyfile.cpp:1666 ``` So the problem is not limited to XML reopening. It also appears to affect persisted/reloaded state after saving. ## Additional checks performed - Original file opens in 5.1.3 without issue - 5.1.3 consistency check reports data is consistent - After patching `AStd::Equity` split references, 5.2.2 can open the file once - The failure appears only after save/reopen in 5.2.2 - Similar failures appear whether saving back to XML/KMY or to SQLite - The account and category IDs reported by 5.2.2 as unknown are still present in the XML structure ## Expected behavior KMyMoney 5.2.2 should do one of the following reliably: 1. Automatically migrate legacy split references from `AStd::Equity` to a proper equity child account, or 2. Continue to support such legacy references when opening older files, and 3. Properly preserve or migrate old-style account/category IDs such as `8-account` / `326-category` during save/reopen, without producing `unknown account` errors later. ## Actual behavior - 5.2.2 rejects the original 5.1.3 XML because of direct split references to `AStd::Equity` - after manual patching, 5.2.2 can open the file once - after saving and reopening, 5.2.2 fails on legacy IDs such as `8-account` - similar reopen failure occurs with SQLite (`Unknown account`) ## Why this matters This blocks migration of older real-world KMyMoney files that are still valid and usable in 5.1.3, and may affect other long-time users upgrading to 5.2.x. ## Attachments suggested 1. Minimal reproducible XML showing: - legacy IDs like `8-account` / `326-category` - a split referencing `AStd::Equity` 2. Full anonymized XML from 5.1.3 3. If useful, patched version where only `AStd::Equity` split references were replaced by `A000002` ## One-line conclusion This looks like a legacy migration / persistence bug in 5.2.2 involving both: - direct split references to standard account roots such as `AStd::Equity` - and reloading of older account/category identifier formats such as `8-account` and `326-category` -- You are receiving this mail because: You are watching all bug changes.
