In section $9.5$ of Weinberg's Lectures on Quantum Mechanics, he uses an example to explain the clasification of constraints. The Lagrangian for a non-relativistic particle that is constrained to remain on a surface described by
$$f(\vec x)=0\tag{1}$$
can be taken as
$$L=\frac 12 m \dot{\vec x}^2-V(\vec x)+\lambda f(\vec x).\tag{2}$$
Apart from the primary constraint $(1)$ there is also a secondary one, arising from the imposition that $(1)$ is satisfied during the dynamics $$\dot {\vec x}\cdot\vec \nabla f(\vec x)=0.\tag{3}$$
Then he states that imposing $[x_i,p_j]=i\hbar\delta_{ij}$ would be inconsistent with the constraints $(1)$ and $(3)$ (which reads $\vec{p}\cdot\vec{\nabla}f=0$ in the Hamiltonian formalism). How can I see this inconsistency?