A bob of mass $m$ is attached to the base of a cart via a thread of length $l$. The cart is accelerating with a non-uniform acceleration with magnitude $a$. The positive x-direction is towards the right and the positive y-direction is downwards. A simple diagram of the situation is shown in the figure above. The problem which I am facing is that when I calculate the magnitude of tension $T$ in the thread using two different approaches, I get two different values. Please help me find the mistake in my solution.
First approach (Observer is stationary)
Assuming the magnitude of the displacement of the cart from its initial position to be $x_c$, the bob's $x$ and $y$ displacement from its initial position can be written as:
$x = x_c + l\sin\theta$
$y = l\cos\theta$
From Newton's laws, we will get:
$-T\sin\theta = m\ddot x = m\ddot x_c + ml(-\dot \theta^2\sin\theta + \ddot \theta\cos\theta)$
$mg - T\cos\theta = m\ddot y = ml(-\dot \theta^2\cos\theta - \ddot \theta\sin\theta)$
If we multiply the above equations by $\sin\theta$ and $\cos\theta$ respectively and add them up, we get the following equation: $T = mg\cos\theta -ma\sin\theta + ml\dot \theta^2$
Second approach (Observer is present in the cart)
From the point of view of this observer, a pseudo force will act on the bob in the negative x-direction. From this reference frame, since there will be no displacement of the bob along the thread, from Newton's laws: $T = mg\cos\theta - ma\sin\theta$
As you can see, we obtain two different values of $T$ using two different approaches. Please help me find out the mistake I am making.