The Einstein equations can be written as (1): $$R_{ab}-\frac{1}{2}Rg_{ab} = -8\pi GT_{ab}$$
or by contracting the above equation with the metric tensor and resubstituting: (2) $$R_{ab}=8\pi G(\frac{1}{2}Tg_{ab}-T_{ab}).$$
In a vacuum, equation (1) reduces to $R_{ab}-\frac{1}{2}Rg_{ab}=0$ and equation (2) reduces to $R_{ab}=0$, which implies that in a vacuum, $R=0$.
However, if I explicitly calculate $R$ for a plane wave of the form $$h_{ab} = A_{ab}\exp(ikx)$$ (the Minkowski metric $\eta_{ab}$ perturbed by $h_{ab}$), I obtain: $$R=k^ak^bh_{ab}-k^\lambda k_\lambda h\ \ ,$$ where $h=\eta_{ab}h^{ab}$, which looks like some sort of wave equation, but is nonzero. It's supposed to be $0$ but is not. Why?