See here:
https://www.mail-archive.com/search?l=mid&q=a7960223ee91696e916b281d1d9fc55df10a9480.camel%40gmail.com
Description from José pasted below:
Functions `length_in_bp` and `revert_flex_inset` have an error in a
(almost) never used path. The reason why this was never triggered is
because this is part of the code where we try all the best efforts
to recover from an ill-formed LyX file.
The problem is that the functions call the `document` variable to
issue an warning if the file does not follow the usual structure.
The simple fix is to add that variable (as the first for the
functions) and to add them at all the places where the functions are
called.
For reference this code was introduced by Georg (Baum) more than 8
years ago and it was never reported. So the issue is not urgent in
any meaningful way. :-)
In `lyx2lyx/lyx_2_0.py`, in the function `revert_nameref`, there is
a call to the document variable. The same as all the above.
In `lyx2lyx/lyx_2_4.py`, in the `class fontmapping`. Similar to the
above but now for error.
Remove acknowledgment theorem types
As we have learned, these shouldn't have been added from the get go.
Documents having it get a local layout definition.
Also, perform the URL fixing magic for DocBook and XHTML.
As it was, it was impossible to enter e.g. "tel:" type links. Now
choosing the "Other" type just outputs the URL as given.
Also, the addition of "http" or "file" was not being done for
DocBook and XHTML. Now it is.
Both lyx2lyx and LyX write output to the terminal, and it's helpful
to know which messages are coming from lyx2lyx. For example, before
this commit if we opened a document in LyX that has a newer file format than
lyx2lyx can deal with, we see the following output in the terminal:
Warning: 619: Format not supported.
Warning: Quitting.
Error: Document format failure
The first two lines (the warnings) are output from lyx2lyx, and the
third is output by LyX. This output was particularly confusing
because I first thought "LyX tries to quit if the document is too
new?", but in fact LyX still stays open; it just doesn't open the
document. After this change, the output is now the following:
lyx2lyx warning: 619: Format not supported.
lyx2lyx warning: Quitting.
Error: Document format failure