Optimization Error:

I am minimizing a function with the Optim package. I am supplying a gradient (that is calculated using AD). I am using the LBFGS() option. However the following error keeps occuring:

AssertionError: isfinite(phi_c) && isfinite(dphi_c)

Stacktrace:
  [1] secant2!(ϕdϕ::LineSearches.var"#ϕdϕ#6"{Optim.ManifoldObjective{OnceDifferentiable{Float64, Array{Float64, 5}, Array{Float64, 5}}}, Array{Float64, 5}, Array{Float64, 5}, Array{Float64, 5}}, alphas::Vector{Float64}, values::Vector{Float64}, slopes::Vector{Float64}, ia::Int64, ib::Int64, phi_lim::Float64, delta::Float64, sigma::Float64, display::Int64)
    @ LineSearches C:\Users\weerd\.julia\packages\LineSearches\Ki4c5\src\hagerzhang.jl:369
  [2] (::HagerZhang{Float64, Base.RefValue{Bool}})(ϕ::Function, ϕdϕ::LineSearches.var"#ϕdϕ#6"{Optim.ManifoldObjective{OnceDifferentiable{Float64, Array{Float64, 5}, Array{Float64, 5}}}, Array{Float64, 5}, Array{Float64, 5}, Array{Float64, 5}}, c::Float64, phi_0::Float64, dphi_0::Float64)
    @ LineSearches C:\Users\weerd\.julia\packages\LineSearches\Ki4c5\src\hagerzhang.jl:269
  [3] HagerZhang
    @ C:\Users\weerd\.julia\packages\LineSearches\Ki4c5\src\hagerzhang.jl:101 [inlined]
  [4] perform_linesearch!(state::Optim.LBFGSState{Array{Float64, 5}, Vector{Array{Float64, 5}}, Vector{Array{Float64, 5}}, Float64, Array{Float64, 5}}, method::LBFGS{Nothing, InitialStatic{Float64}, HagerZhang{Float64, Base.RefValue{Bool}}, Optim.var"#19#21"}, d::Optim.ManifoldObjective{OnceDifferentiable{Float64, Array{Float64, 5}, Array{Float64, 5}}})
    @ Optim C:\Users\weerd\.julia\packages\Optim\LScFu\src\utilities\perform_linesearch.jl:59
  [5] update_state!(d::OnceDifferentiable{Float64, Array{Float64, 5}, Array{Float64, 5}}, state::Optim.LBFGSState{Array{Float64, 5}, Vector{Array{Float64, 5}}, Vector{Array{Float64, 5}}, Float64, Array{Float64, 5}}, method::LBFGS{Nothing, InitialStatic{Float64}, HagerZhang{Float64, Base.RefValue{Bool}}, Optim.var"#19#21"})
    @ Optim C:\Users\weerd\.julia\packages\Optim\LScFu\src\multivariate\solvers\first_order\l_bfgs.jl:204
  [6] optimize(d::OnceDifferentiable{Float64, Array{Float64, 5}, Array{Float64, 5}}, initial_x::Array{Float64, 5}, method::LBFGS{Nothing, InitialStatic{Float64}, HagerZhang{Float64, Base.RefValue{Bool}}, Optim.var"#19#21"}, options::Optim.Options{Float64, Nothing}, state::Optim.LBFGSState{Array{Float64, 5}, Vector{Array{Float64, 5}}, Vector{Array{Float64, 5}}, Float64, Array{Float64, 5}})
    @ Optim C:\Users\weerd\.julia\packages\Optim\LScFu\src\multivariate\optimize\optimize.jl:54
  [7] optimize
    @ C:\Users\weerd\.julia\packages\Optim\LScFu\src\multivariate\optimize\optimize.jl:36 [inlined]
  [8] optimize(f::Function, g::Function, initial_x::Array{Float64, 5}, method::LBFGS{Nothing, InitialStatic{Float64}, HagerZhang{Float64, Base.RefValue{Bool}}, Optim.var"#19#21"}, options::Optim.Options{Float64, Nothing}; inplace::Bool, autodiff::Symbol)
    @ Optim C:\Users\weerd\.julia\packages\Optim\LScFu\src\multivariate\optimize\interface.jl:155

How am I to interpret this? What course of action can I take to get around this problem?
Thanks for the help in advance

Probably a programming error in Linesearches.jl. You could open an issue?

Others might help with the question if you can switch the line search algorithm easily.

I have opened an issue- however this has been discussed some time ago already in an issue of LineSearch.jl und has not changed yet appearently.

It was also discussed here and one of the responses shows how to use alternative line searches…

I have seen that as well. However, these work not as well in my experience. And since this (the assertion error) seems to be some kind of runtime error that LineSearch.jl gives out I am still hoping for a fix of that particular method.