If auto.index is TRUE, the RHS of := is evaluated even if there are zero rows in the subset.
packageVersion('data.table')
#[1] ‘1.9.5’
options(datatable.auto.index=TRUE)
DT <- data.table(a=1:2)
DT[a==3, b:=d+1]
# Error in eval(expr, envir, enclos) : object 'd' not found
Since DT[a==3] above returns a zero row data.table, there is nothing to assign in the j expression, so it should not be evaluated. This did not throw an exception in 1.9.3 and does not throw an exception if auto.index is turned off.
options(datatable.auto.index=FALSE)
DT[a==3, b:=d+1]