Error prohibited this line_item from being saved Order must exist

I am trying to find a solution to add a product to the cart, by creating the line_item component that will combine the cart and product IDs together. When I add a product to the cart I redirected my self to /line_items?product_id=1, and I constantly getting an error is that Error prohibited this line_item from being saved. Order must exist

I feel like the problem is in this create a line_item controller

product = Product.find(params[:product_id])
@line_item = @cart.add_product(product.id)

# @cart.save!

if @line_item.save
  render json: { cart_url: cart_path(@cart), card_id: @cart.id }
else
  render :new
end

My Cart Model

  def add_product(product_id)
    current_item = line_items.find_by(product_id: product_id)
    if current_item
      current_item.increment(:quantity, 1)
    else
      current_item = line_items.build(product_id: product_id)
    end
    current_item
  end

And I saw that terminal is trying to rollback something on the current cart

Started POST "/line_items?product_id=1" for 127.0.0.1 at 2018-11-08 00:24:54 -0600
Processing by LineItemsController#create as HTML
  Parameters: {"authenticity_token"=>"Y6t2ZiEeWLDoV8jrL27ak0X8TXCAw==", "product_id"=>"1"}
   (0.2ms)  BEGIN
  ↳ app/controllers/concerns/current_cart.rb:10
   (0.3ms)  ROLLBACK
  ↳ app/controllers/concerns/current_cart.rb:10
  User Load (3.1ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/line_items_controller.rb:15
  Product Load (1.1ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/line_items_controller.rb:22
   (0.3ms)  BEGIN
  ↳ app/controllers/line_items_controller.rb:27
  Product Load (1.4ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/line_items_controller.rb:27
   (0.4ms)  ROLLBACK
  ↳ app/controllers/line_items_controller.rb:27
  Rendering line_items/new.html.erb within layouts/application
  Rendered line_items/_form.html.erb (3.5ms)
  Rendered line_items/new.html.erb within layouts/application (6.7ms)

And my current cart

module CurrentCart
  extend ActiveSupport::Concern

  private

  def set_cart
    begin
      @cart = Cart.find(params[:card_id] || session[:cart_id])
    rescue ActiveRecord::RecordNotFound
      @cart = Cart.create
    end

    session[:card_id] = @cart.id
  end
end