I had a similar situation where
#' @export
A <- setRefClass("A")
cause the same error, which I resolved using:
A <- setRefClass("A")
#' @export
A
Curiously, this was in a file that I had not modified in a while, so it's still a bit of a mystery...