2. If $x \in(-\infty,-1]$, the inequality
$$
\left(m-m^{2}\right) 4^{x}+2^{x}+1>0
$$

always holds, then the range of real number $m$ is $\qquad$
2. $-2-\frac{2^{x}+1}{4^{x}}$.
Let $t=\left(\frac{1}{2}\right)^{x}$.
Since $x \in(-\infty,-1)$, then $t \geqslant 2$. Therefore, we have $-\frac{2^{x}+1}{4^{x}}=-t^{2}-t=-\left(t+\frac{1}{2}\right)^{2}+\frac{1}{4} \leqslant-6$.
From $m-m^{2}>-6$, solving gives $-2<m<3$.