6. Given the complex number $z$ satisfies
$$
(a-2) z^{2018}+a z^{2017} \mathrm{i}+a z \mathrm{i}+2-a=0 \text {, }
$$

where, $a<1, \mathrm{i}=\sqrt{-1}$. Then $|z|=$ $\qquad$ .
6. 1 .

Notice that,
$$
\begin{array}{l}
z^{2017}((a-2) z+a \mathrm{i})=a-2-a z \mathrm{i} . \\
\text { Hence }|z|^{2017}|(a-2) z+a \mathrm{i}|=|a-2-a z \mathrm{i}| .
\end{array}
$$

Let $z=x+y \mathrm{i}(x, y \in \mathbf{R})$.
$$
\begin{array}{l}
\text { Then }|(a-2) z+\left.a \mathrm{i}\right|^{2}-|a-2-a z \mathrm{i}|^{2} \\
=|(a-2) x+((a-2) y+a) \mathrm{i}|^{2}- \\
|a-2+y a-a x i|^{2} \\
=((a-2) x)^{2}+((a-2) y+a)^{2}- \\
(a-2+y a)^{2}-(-a x)^{2} \\
=4(1-a)\left(x^{2}+y^{2}-1\right) \\
=4(1-a)\left(|z|^{2}-1\right) \text {. } \\
\end{array}
$$

If $|z|>1$, then
$$
\begin{array}{l}
|a-2-a z \mathrm{i}||a-2-a z \mathrm{i}|,
\end{array}
$$

this contradicts equation (1).
If $|z|<1$, it would also lead to a contradiction.
Therefore, $|z|=1$.