If we remove setDT from f there will be no error anymore
dt = data.table(a = c("b","a","c"), v = 1:3)
dt[a == "a"] ## creates index
f = function(x) {
setDT(x)
x[a == "b"]
}
f(
dplyr::filter(dt, a != "a")
)
#Error: Internal error in getindex: index 'a' exists but is invalid. Please report to the data.table issues tracker.
1.17.8