R encountered a fatal error The session was terminated.

I am working on ERA5 hourly NC file, using terra and raster library, I would like to replace layer values with specific values but RStudio does not allow me and give me the error..

xxx<-rast(nc file)
xxx
class : SpatRaster
dimensions : 101, 253, 455832 (nrow, ncol, nlyr)
resolution : 0.25, 0.25 (x, y)
...

I would like change xxx[20,50,]<- 10
sth like that but Rstudio completely crash and give me error R encountered a fatal error The session was terminated....

please let me know your solution or suggestion