Adding product to cart cause error 'The stock item for Product is not valid.'?

solved!, Instead of the product object pass product ID to addProduct() method worked. See the corrected code below.

    /**
     * Add air product to the cart.
     */
    public function addSubscriptionToCart($product)
    {
        try {
            // Create cart instance.
            $cart = Mage::getModel('checkout/cart');

            // Initialize the cart.
            $cart->init();
            $cart->addProduct($product->getId()); // pass product ID
            $cart->save();

            return true;

        } catch(Exception $e) {
            Mage::log($e->getMessage());
            return false;
        }
    }

I had the same issue. But i was using another code for adding to the cart:

$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->addProduct($_product, 1);
$quote->collectTotals()->save();

And my problem was in wrong product object. I was loading it by attribute "sku":

Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);

When i changed it to simple load

Mage::getModel('catalog/product')->load($id);

then error was resolved.

So problem was in "wrong" product object by loadByAttribute function.