Lagrange multipliers with non-smooth constraints

I read in a textbook a passing comment that Lagrange multipliers are not applicable if there are points of non-differentiability in the constraints (even if the constraints are continuous). For example, in the following problem:

$\min_{\boldsymbol x} \boldsymbol{a} \cdot \boldsymbol{x}$

s.t. $\max(x_1, x_2) = x_3$

for vectors $\boldsymbol a \in \mathbb{R}^3$ and $\boldsymbol x \in \mathbb{R}^3$.

Why can't I use Lagrange multipliers here? If I push through the standard steps of constructing the Lagrangian, differentiating w.r.t. to variables and Lagrange multipliers, setting the partial derivatives to 0, and solving (assuming I'm able to), what goes wrong? Is there some related but alternative method that I can use?

What goes wrong is that the minimum might happen to be at a point where a derivative might not exist. Try e.g. minimize $y$ subject to $g(x,y) = y - |x| = 0$. The minimum is at $(0,0)$, where $\frac{\partial g}{\partial x}$ does not exist.