We study the solutions [Formula: see text] to the equation [Formula: see text] where [Formula: see text] and [Formula: see text] are given. We significantly improve the existence results of [G. Csató and B. Dacorogna, A Dirichlet problem involving the divergence operator, Ann. Inst. H. Poincaré Anal. Non Linéaire 33 (2016) 829–848], where this equation has been considered for the first time. In particular, we prove the existence of a solution under essentially sharp regularity assumptions on the coefficients. The condition that we require on the vector field [Formula: see text] is necessary and sufficient. Finally, our results cover the whole scales of Sobolev and Hölder spaces.