3. The complex sequence $\left\{a_{n}\right\}$ satisfies
$$
a_{1}=0, a_{n}=a_{n-1}^{2}+\mathrm{i}(n \geqslant 2) .
$$

Then the sum of its first 2007 terms is $\qquad$
3. $-1003+2$ i.

From the given, we have $a_{1}=0, a_{2}=\mathrm{i}, a_{3}=-1+\mathrm{i}$,
$$
a_{4}=-\mathrm{i}, a_{5}=-1+\mathrm{i}, a_{6}=-\mathrm{i}, \cdots \cdots
$$

It can be seen that, when $n \geqslant 3$,
$$
a_{n}=\left\{\begin{array}{ll}
-1+\mathrm{i}, & n \text { is odd; } \\
-\mathrm{i}, & n \text { is even. }
\end{array}\right.
$$

Therefore, $S_{2007}$
$$
\begin{array}{l}
=0+\mathrm{i}+(-1+\mathrm{i})+1002[(-\mathrm{i})+(-1+\mathrm{i})] \\
=-1003+2 \mathrm{i} .
\end{array}
$$