The electric field strength in a region is given by $\vec{E}=\dfrac {x\widehat{i} +y\widehat {j}}{x^{2}+y^{2}}$.

In order to calculate the net charge inside a sphere of radius $a$ centred at origin, I evaluated $\vec{\nabla }\cdot \vec{E}$ using quotient rule of differentiation as

$$\frac{(x^2+y^2)-2x(x)}{(x^2+y^2)^2} + \frac{(x^2+y^2)-2y(y)}{(x^2+y^2)^2} = \frac{(y^2-x^2)+(x^2-y^2)}{(x^2+y^2)^2}=0 = \frac{\rho}{\epsilon_{0}}\\ \Downarrow \\ \rho=0$$(vector form of gauss law). So this gives charge inside the sphere as 0(which is incorrect).

However, on using the integral form of gauss law equation, and noting that the field is radial and spherically symmetric,

$$\int \vec {E}\cdot \vec{dA} =|E|\times4 \pi a^2 = \frac{1}{a} \cdot 4\pi a^2=4\pi a = \frac{q}{\epsilon_{0}} \implies q=4 \pi a \epsilon_{0}$$ which is correct.

Why is the first method incorrect?