We investigate the existence of solutions of \begin{equation} divF=\mu,\text{ on } \mathbf{R}^{d}. \tag{*} \end{equation} Here, $\mu\geq0$ is a Radon measure, and we look for a solution $F\in X(\mathbf{R}^{d}\rightarrow\mathbf{R}^{d})$, where $X$ is a rearrangement-invariant space. We first prove the equivalence of the following assertions: (i) (*) has a solution for some nontrivial $\mu$; (ii) the function $x\mapsto |x|^{1-d}1_{B^{c}}(x)$ belongs to $X$. Here, $B$ is the unit ball in $\mathbf{R}^{d}$. We next investigate the solvability of (*) when $\mu$ is fixed. A sufficient condition is that $I_{1}\mu\in X$, where $ I_{1}\mu$ is the 1-Riesz potential of $\mu$. This condition turns out to be also necessary when the Boyd indexes of $X$ belong to $(0,1)$. Our analysis generalizes the one of Phuc and Torres (2008) when $X=L^{p}$.