Oh no, this was totally my fault. I said I hadn’t added anything custom to Yunohost, but I forgot that I added a database trigger to Mattermost to set a default theme for each new user. That’s the line that was throwing an error in db.sql (creating my custom trigger). I removed the line from the ,tar and the backup restore works now. Thanks for pointing me in the right direction!