I had the same error after updating sqlite and struct. After update i think dbversion=19 should be correct. Your solution
UPDATE opts SET val=18 WHERE opt='dbversion'
solved the problem. After that i did
UPDATE opts SET val=19 WHERE opt='dbversion'
and it works further.
Maybe the first step is not neccessary. Unfortunately i did not check dbversion with SELECT * FROM opts
before.
I have another setup where the problem did not occur.