I had this issue and found out that the developers of {targets}
recommend installing the latest version of {data.table}
from CRAN to address this exact issue:
https://github.com/ropensci/targets/discussions/1489#discussioncomment-13146977
They suggest minimum version of 1.16.0. I upgraded and it fixed it for me!