Strange error in Ecto.Multi

Thanks for sharing, this is the working code:

  multi_result =
    Multi.new() 
    |> Multi.run(:book_to_be_returned, fn _ -> Works.update_book_to_be_returned_multi(line.book_id) end)

and:

def update_book_to_be_returned_multi(book_id) do
alias Mango.Books
alias Mango.Books.Book

case Repo.get_by(Book, %{id: book_id, status: :out}) do
  nil ->
    {:error, %{error: "Book not found or already available.."}}

  book ->
    case Books.update_book(book, %{status: :available}) do
      {:ok, book} -> {:ok, book}  # update_book returns %{:ok, book_object } so this is the correct match
      nil -> {:error, %{error: "Error occured while updating the book.."}}
    end
end

end