  We performed a search for a new generic $X$ boson, which could be a scalar
($S$), pseudoscalar ($P$), vector ($V$) or an axial vector ($A$) particle
produced in the 100 GeV electron scattering off nuclei, $e^- Z \to e^- Z X$,
followed by its invisible decay in the NA64 experiment at CERN. No evidence for
such process was found in the full NA64 data set of $2.84\times 10^{11}$
electrons on target. We place new bounds on the $S, P, V, A$ coupling strengths
to electrons, and set constraints on their contributions to the electron
anomalous magnetic moment $a_e$, $|\Delta a_{X}| \lesssim 10^{-15} - 10^{-13}$
for the $X$ mass region $m_X\lesssim 1$ GeV. These results are an order of
magnitude more sensitive compared to the current accuracy on $a_e$ from the
electron $g-2$ experiments and recent high-precision determination of the fine
structure constant.
