2. If the equation with respect to $x$
$$
\sqrt{1+a-x}-a+\sqrt{x}=0
$$

has real solutions, then the range of positive real number $a$ is $\qquad$
2. $\left[\frac{1+\sqrt{5}}{2}, 1+\sqrt{3}\right]$.

Let $t=\sqrt{x}$. Then $0 \leqslant t \leqslant \sqrt{1+a}$.
The original equation becomes
$\sqrt{1+a-t^{2}}=a-t$.
Squaring both sides of equation (1) and rearranging, we get
$2 t^{2}-2 a t+a^{2}-a-1=0$.
By $\Delta=4 a^{2}-8\left(a^{2}-a-1\right) \geqslant 0$, we get $a^{2}-2 a-2 \leqslant 0$.
Solving this, we get $1-\sqrt{3} \leqslant a \leqslant 1+\sqrt{3}$.
From equation (1), we have $a-t \geqslant 0$.
Combining equation (2), we have $a^{2}-a-1=2 t(a-t) \geqslant 0$.
Solving this, we get $a \geqslant \frac{1+\sqrt{5}}{2}$ or $a \leqslant \frac{1-\sqrt{5}}{2}$.
From equations (3) and (4), the range of positive real number $a$ is $\left[\frac{1+\sqrt{5}}{2}, 1+\sqrt{3}\right]$.