Can't restore from backup (previous issue #355) - Multiple ROOT accounts in backup
Hi, Following a data loss on my multi-level and multi-currency database I have attempted to restore my accounts from a backup point but keep getting the message, "an error occurred while importing the gnucash accounts. Multiple root accounts exist in book". I know this issue has been raised before but I couldn't find how to resolve it. Zip file attached. Many thanks Ken 20151207_212902_gnucash_export.gnca.zip
There are indeed multiple root accounts in the book. @fefe982 I have seen this error before. Could you please check if we export multiple root accounts inadvertently? Maybe it is connected somehow to single-entry mode?
@kens2929 You do use the app in single-entry mode, right? Deleting the extra root accounts in the backup fixes the problem and the file can import. I have been able to import it on my device, but am having trouble uploading it here to github. if you send an email to [email protected] I can send you the fixed file.
hey @fefe982 did you find anything on this issue?
It does have two ROOT accounts.
<gnc:account version="2.0.0">
<act:name>ROOT Account</act:name>
<act:id type="guid">09edbed54630425ea7941d90d6ee172e</act:id>
<act:type>ROOT</act:type>
<act:commodity><cmdty:space>ISO4217</cmdty:space><cmdty:id>AUD</cmdty:id></act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:slots>
<slot><slot:key>placeholder</slot:key><slot:value type="string">false</slot:value></slot>
<slot><slot:key>favorite</slot:key><slot:value type="string">false</slot:value></slot>
</act:slots>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>ROOT Account</act:name>
<act:id type="guid">ab938ab6c9684fcdb5db53dadc258be7</act:id>
<act:type>ROOT</act:type>
<act:commodity><cmdty:space>ISO4217</cmdty:space><cmdty:id>AUD</cmdty:id></act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:slots>
<slot><slot:key>placeholder</slot:key><slot:value type="string">false</slot:value></slot>
<slot><slot:key>favorite</slot:key><slot:value type="string">false</slot:value></slot>
</act:slots>
</gnc:account>
The current import process treat this as an error.
Is it right that the current version supports multiple book now? The entire export and import process must be updated to work with multiple books. It is no easy work.
BTW, I don't know if the desktop version supports xml file containing multiple books, although the XML file does contain a notation about how many books are inside.
Yes, I was aware of the two ROOT accounts in the XML file. According to the user, IIRC the XML file was generated by the app. My question was if you had any idea why the app generated an XML with two roots. That must be a bug I think.
The release version does not support multiple books, only develop branch. And even then, there is only one XML file per book. So nothing changes with the XML export in that regard. Sorry about any miscommunication.
On 20.01.2016, at 12:52, Yongxin Wang [email protected] wrote:
It does have two ROOT accounts.
<gnc:account version="2.0.0"> act:nameROOT Account/act:name <act:id type="guid">09edbed54630425ea7941d90d6ee172e/act:id act:typeROOT/act:type act:commoditycmdty:spaceISO4217/cmdty:spacecmdty:idAUD/cmdty:id/act:commodity act:commodity-scu100/act:commodity-scu act:slots
slot:keyplaceholder/slot:key<slot:value type="string">false/slot:value slot:keyfavorite/slot:key<slot:value type="string">false/slot:value /act:slots /gnc:account <gnc:account version="2.0.0"> act:nameROOT Account/act:name <act:id type="guid">ab938ab6c9684fcdb5db53dadc258be7/act:id act:typeROOT/act:type act:commoditycmdty:spaceISO4217/cmdty:spacecmdty:idAUD/cmdty:id/act:commodity act:commodity-scu100/act:commodity-scu act:slotsslot:keyplaceholder/slot:key<slot:value type="string">false/slot:value slot:keyfavorite/slot:key<slot:value type="string">false/slot:value /act:slots /gnc:account The current import process treat this as an error.Is it right that the current version supports multiple book now? The entire export and import process must be updated to work with multiple books. It is no easy work.
BTW, I don't know if the desktop version supports xml file containing multiple books, although the XML file does contain a notation about how many books are inside.
— Reply to this email directly or view it on GitHub.
So the main problem would finding out when the export generated an XML with two ROOTs in a book.
I didn't check the code, but I think that there is no error check for this in the exporting process. So if there are two ROOTs in the db, there may be two ROOTs in the XML.
hmm that's a good point. If there are multiple in the db, multiple will be exported. I'll be on the lookout for any code paths which could lead to that. Thanks
One way to mitigate this would be to add a constraint to the database which does not allow more than one ROOT. Deferring this to be done as part of big db changes