Here is my incorrect attempt at solving $$ x + 1 + \sqrt{4x + 1} = 0. $$
Subtracting $ \sqrt{4x + 1} $ from both sides, $$ x + 1 = -\sqrt{4x + 1} $$
Squaring both sides, $$ x^2 + 2x + 1 = 4x + 1 $$
Subtracting $ 4x + 1 $ from both sides, $$ x^2 - 2x = 0 $$
We have obtained $$ x(x - 2) = 0 $$
It has two solutions: $ x = 0 $ and $ x = 2 $.
But if we substitute $ x = 0 $ in LHS of the original equation we get $$ x + 1 + \sqrt{4x + 1} = 1 + \sqrt{1} = 2 $$
If we substitute $ x = 2 $ in LHS of the original equation we get $$ x + 1 + \sqrt{4x + 1} = 3 + \sqrt{9} = 6 $$
Apparently I have made a mistake in some step that has led to this contradiction. Which step is incorrect in my solution above? It must be the squaring step that changes the minus sign to positive sign.
But squaring both sides is an often used step in many equations. What rules I need to keep in mind while solving such equations so that I do not get incorrect solution after squaring both sides?

Here is one correct way to solve this problem I learnt from comments.
I should write
$$ x + 1 = -\sqrt{4x + 1} \iff \begin{cases} (x + 1)^2 = 4x + 1 \\ (x + 1) \le 0 \end{cases} \iff \begin{cases} x(x - 2) = 0 \\ x \le -1 \end{cases} $$
Then I should solve $ x(x - 2) = 0 $ to get $ x = 0 $ and $ x = 2 $. Then I should reject both solutions because both solutions do not satisfy $ x \le 1 $. Therefore the equation has no solutions.