I mean, when you launch a compiled version of darktable with the command line, you can specify a config directory.
I advice you to have a different config directory for the compiled version than the standard one, in order not to mess with the database of the stable version that you may have installed.
What happens here is that you used a very recent version of darktable, and then use an older version with the same configuration directory
The recent version updated the library.db database, and the older version cannot read it anymore, as the database is too new for it.
You can get rid of the error either by deleting the library.db so that darktable can generate a new one (WARNING, if you do that, all tags, collections etc will be lost), either by specifying a new config directory using the commandline so that darktable can work on a different config directory (this will preserve the library.db file: you will be able to read it on a recent version of darktable).
Thanks for the detailed explanation. I am afraid I do not know how to create a config directory, and what needs to be in it. If I upgrade debian to testing, do you think it night work? I am not afraid of messing up debian as I have a backup image.
When you specify a directory using the configdir commandline option, darktable creates it if needed So you don’t have to worry about what to put inside
Restoring your backup, you have restore the /home/username/.config directory, which is the one darktable uses by default. It restored your library.db database to an older version, that’s why you don’t get the error anymore