4. When $a<0$, the solution to the equation
$$
x|x|+|x|-x-a=0
$$

is $\qquad$ .
4. $x=-1-\sqrt{1-a}$.

When $a<1$, the solution is $x=\frac{-2 \pm \sqrt{4-4a}}{2}=-1 \pm \sqrt{1-a}$ (take the negative value).