2. If real numbers $x, y$ satisfy $x^{2}+2 \cos y=1$, then the range of $x-\cos y$ is $\qquad$
$$
\cos y=\frac{1-x^{2}}{2} \in[-1,1] \Rightarrow x \in[-\sqrt{3}, \sqrt{3}] \text {, }
$$

Thus, $x-\cos y=x-\frac{1-x^{2}}{2}=\frac{1}{2}\left(x^{2}+2 x-1\right)=\frac{1}{2}(x+1)^{2}-1 \in[-1, \sqrt{3}+1]$. Therefore, the range of $x-\cos y$ is $[-1, \sqrt{3}+1]$.