If I want to find the minimum of $f(x) = x^2$ subject to the constraint $g(x) = 2x + 1 = 0$, then I would first isolate $x$ from $g$ and insert into $f$:
$$ 2x + 1 = 0\\ x = -1/2 $$
So $$ f(x) = x^2 = (-1/2)^2 = 1/4 $$
And now set the first derivative equal $0$:
$$ df/dx (-1/4) = 0 $$
So the derivative is constant zero.
But clearly, the constrained minima are not zero:

Where is the approach wrong?
$g(x)$ defines your feasible set. Solving it, gives you the answer.