Using Keras 3.8.0 and even 3.7.0 and tensorflow 2.18 causes this issue. This was fixed after I downgraded keras to 3.6.0.