LiteDatabase error: System.Exception: LiteDB ENSURE: empty page must be defined as empty type

I’ve been working with a LiteDatabase for a .NET MAUI mobile app, the idea behind the app is to pull everything from a live database and store it in a local database.

Only recently have I been getting the error “LiteDB ENSURE: empty page must be defined as empty type”, and this is happening intermittently after the local database collection has been cleared using

using (LiteDatabase db = new LiteDatabase(UserDatabasePath))
{
    return db.DropCollection(collectionName);
}
And t

hen reset using

List<CompressorModel> compressors = JsonConvert.DeserializeObject<List<CompressorModel>>(data.Result);
using (LiteDatabase db = new LiteDatabase(UserDatabasePath))
{
     ILiteCollection<CompressorModel> hCollection = db.GetCollection<CompressorModel>(collectionName);
    //hCollection.Insert(compressors);
}

(We have a few dozen different types of collections, this is just an example of one)
And intermittently I will get that error in a try/catch block with random collections, Compressors being the most recent one and the one that is giving me the most issue. For reference, here’s the stack trace
at LiteDB.Constants.ENSURE(Boolean conditional, String message)
at LiteDB.Engine.Snapshot.NewPageIndexPage
at LiteDB.Engine.IndexService.CreateIndex(String name, String expr, Boolean unique)
at LiteDB.Engine.CollectionService.Add(String name, CollectionPage& collectionPage)
at LiteDB.Engine.CollectionService.Get(String name, Boolean addIfNotExists, CollectionPage& collectionPage)
at LiteDB.Engine.Snapshot..ctor(LockMode mode, String collectionName, HeaderPage header, UInt32 transactionID, TransactionPages transPages, LockService locker, WalIndexService walIndex, DiskReader reader, Boolean addIfNotExists)
at LiteDB.Engine.TransactionService.g__create|43_0(<>c__DisplayClass43_0& )
at LiteDB.Engine.TransactionService.CreateSnapshot(LockMode mode, String collection, Boolean addIfNotExists)
at LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.b__0(TransactionService transaction)
at LiteDB.Engine.LiteEngine.AutoTransaction[Int32](Func2 fn) at LiteDB.Engine.LiteEngine.Insert(String collection, IEnumerable1 docs, BsonAutoId autoId)
at LiteDB.LiteCollection1[[MAUIGMSApp.Models.CompressorModel, MAUIGMSApp, Version=2.3.3.0, Culture=neutral, PublicKeyToken=null]].Insert(IEnumerable1 entities)
at MAUIGMSApp.ViewModels.DatabaseService.GetCompressors(SyncService ss) in C:GIT – MAUI FieldsyncGMS.FieldSync.MobileMAUIGMSAppViewModelsDatabaseService.cs:line 1800

I assume that the error has something to do with null values based on the error message, but I can’t seem to find anything to support that. I’ve looked through my data quite a few times, and for compressors at least it will allow me to enter a few of them, if I try to only enter about a quarter of whats in our database, but every time I try to pinpoint one compressor that is causing these issues it seems to just accept the one that I think is being the problem when I track it down to a specific one

For other collections it’s normally fixed after I drop all the database and re-pull, but not for compressors

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật