After some more testing I understood what was happening. In fact Gnucash writes in ~/.gnucash/books some data about the book itself, unfortunately under the same filename, overwriting it. Previous versions (1.x) didn't do this, and it was OK to store one's books in ~/.gnucash/books, but now it doesn't work anymore.
The right way to make it work is to store one's books anywhere... but in ~/.gnucash/books.
After some more testing I understood what was happening. In fact Gnucash writes in ~/.gnucash/books some data about the book itself, unfortunately under the same filename, overwriting it. Previous versions (1.x) didn't do this, and it was OK to store one's books in ~/.gnucash/books, but now it doesn't work anymore.
The right way to make it work is to store one's books anywhere... but in ~/.gnucash/books.