12. Given the function $f(x)=\log _{a: 2}\left[a x^{2}+(a+2) x+a+2\right]$, if $f(x)$ has a maximum or minimum value. Find the range of the parameter $a$.
12. $(-2,-1) \cup(-1,0) \cup\left(\frac{2}{3},+\infty\right)$.

Let $g(x)=a x^{2}+(a+2) x+a+2$, when $g(x)$ has a minimum or maximum value greater than zero, $f(x)$ may have an extremum.
$g(x)$ has a minimum value when $a>0, \Delta\frac{2}{3}$;
$g(x)$ has a maximum value when $a<0, \Delta<0 \Rightarrow-2<a<0$.
When $a>\frac{1}{2}$, $f(x)$ has a minimum value; when $-1<a<0$, $f(x)$ has a maximum value; when $-2<a<-1$, $f(x)$ has a minimum value.