Unable to find my mistake in the process of solving a seemingly simple integration problem

Solution 1:

The assumption that one solution is incorrect is false. Both the solutions are correct.

From the comments to the question given by @lulu and @RobertShore makes it clear that exploiting the fact $\tan^{-1}x+\tan^{-1}\frac{1}{x}$ is a constant, we can conclude both solutions are correct.

Further, it is easy to visualize through the following plot showing both the solutions. First solution is blue, Second solution is Red. Graph showing both the solutions