EF Core doesn’t automatically know how to save a List in the database. By default, it tries to use a database array type (text[] in PostgreSQL). However, this doesn’t match well with EF Core’s internal handling, especially when combined with default values.
builder.Entity<User>()
.Property(u => u.PasswordHistory)
.HasConversion(
v => JsonSerializer.Serialize(v, (JsonSerializerOptions?)null),
v => JsonSerializer.Deserialize<List<string>>(v, (JsonSerializerOptions?)null) ?? new List<string>()
);