[GNC] Unable to open GnuCash file: "No suitable backend was found for <FILE>."

john jralls at ceridwen.us
Thu Jul 13 11:55:57 EDT 2023



> On Jul 13, 2023, at 01:34, Tomer Altman <me at tomeraltman.net> wrote:
> 
> On 7/12/23 6:26 PM, john wrote:
>> 
>> 
>>> On Jul 12, 2023, at 16:16, Tomer Altman <me at tomeraltman.net> wrote:
>>> 
>>> Hi everyone,
>>> 
>>> Due to filesystem errors, I had to reinstall MacOS on my 2015 Macbook Air (current OS version: Monterey 12.6.7). After doing so, and restoring my files from a TimeMachine backup using Migration Assistant, I started getting this error when trying to open my accounting file:
>>> 
>>> "No suitable  backend was found for <FILE>."
>>> 
>>> (where "<FILE>" is a stand-in for the actual file name)
>>> 
>>> I was at the time using a version of GnuCash from December 2022. I then reinstalled using the installer available from gnucash.org (current version: "5.3+(2023-06-26)" ). Unfortunately, the error persists.
>>> 
>>> Looking at this error message in the mailing list archives, it seems like this has something to do with using the SQLite back-end. I looked at the 'environment' text file, and it is implementing already the environment variable recommended as a fix:
>>> 
>>> GNC_DBD_DIR={SYS_LIB}/dbd
>>> 
>>> It seems like my install is still unable to find the libraries that it needs, though.
>>> 
>>> It's unclear to me how to diagnose which version of the back-end my file is using, since I cannot open it. Using 'file' and 'head' shows that it is not XML, and I am unable to decompress the file using Gzip. I'm also unable to open it using the sqlite3 command line tool.
>>> 
>>> So, two questions:
>>> 
>>> 1. What's the correct way to verify the back-end type using something other than GnuCash itself?
>>> 
>>> 2. What is wrong with my fresh install that is preventing me from opening up the file?
>>> 
>>> Thanks in advance for any and all advice and assistance!
>> 
>> If it's a SQLite file you can open it with sqlite3, provided by macOS. Just open Terminal and run
>>    sqlite3 /path/to/my/gnucash/file
>> You can use the `.tables` command to list the tables and `.schema <tablename>` to show the structure and compare it with https://wiki.gnucash.org/wiki/SQL.
>> 
>> 99% of the time when users report this problem it's because they're trying to open a log file or a .gcm file instead of their actual book.
>> 
>> Regards,
>> John Ralls
>> 
> Hi John,
> 
> Thank you very much for taking the time to reply. I appreciate it.
> 
> I've tried doing what you are suggesting. Let's say that my "<FILE>" name is "foo.gnucash". When I type the following:
> 
> sqlite3 foo.gnucash
> 
> > .tables
> 
> I get:
> 
> "Error: file is not a database"
> 
> I thought to myself, "Perhaps the SQLite3 file was corrupted?" So I went to a TimeMachine backup of the directory from April (before any issues with my laptop), and copied over foo.gnucash to a temporary directory. This file would open successfully with GnuCash. Using the command line, I see that 'file' correctly identifies it as a gzip compressed file.
> 
> So it seems that this was an issue with the foo.gnucash file getting corrupted, perhaps from the filesystem errors that I was experiencing. Thanks for prompting me to debug this further. I'll restore my file using the *.gnucash backup files, and by adding in the relevant log files.
> 
> If I may be so bold as to suggest a UI improvement: Telling the user "No suitable backend was found for <FILE>" implies that the file is fine, it's just that there's no back-end to support it. That impression was bolstered by the mailing list discussion of missing library paths. I'd suggest wording that makes it clear that the *FILE* is the issue, as in it's either the wrong type, or it is corrupted. Perhaps, "<FILE> is not a recognized GnuCash formatted file."
> 

Tomer,

Good that you sorted it. Note though that if it's gzip-compressed it's an XML file, not a sqlite3 database. Does `file` on the apparently corrupted gnucash file claim that it's a sqlite3 database?

Regards,
John Ralls




More information about the gnucash-user mailing list