4. Given $\sin \theta+\cos \theta=\frac{1}{3}, \theta \in\left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$. Then the value of $\theta$ is ( ).
(A) $-\arccos \frac{\sqrt{21}+1}{9}$
(B) $-\arccos \frac{\sqrt{21}-1}{9}$
(C) $-\arcsin \frac{\sqrt{17}+1}{6}$
(D) $-\arcsin \frac{\sqrt{17}-1}{6}$
4.D.

Given $\sin \theta+\cos \theta=\frac{1}{3}$, squaring both sides and simplifying yields $\sin \theta \cdot \cos \theta=-\frac{4}{9}$.

Considering $\sin \theta, \cos \theta$ as the roots of the quadratic equation $x^{2}-\frac{1}{3} x- \frac{4}{9}=0$, we solve to get $x_{1,2}=\frac{1 \pm \sqrt{17}}{6}$.
Since $\theta \in\left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$, it follows that $\cos \theta>0$.
Therefore, $\cos \theta=\frac{1+\sqrt{17}}{6}, \sin \theta=\frac{1-\sqrt{17}}{6}$.