L-BFGS-B needs finite values of 'fn'

Hi community,
I am trying to GE analysis and my script is as below
library(EMMREML)
traits$GxE <- paste(traits$YEAR, traits$ID, sep = "_")
cov2cor(tcrossprod(X))
Kge <- tcrossprod(X) * tcrossprod(Z %
% Gmatrix, Z)
traits$GxE <- factor(traits$GxE)
rownames(Kge) <- colnames(Kge) <- traits$GxE
emmremlout <- emmremlMultiKernel(
y = matrix(y),
X = X,
Zlist = list(Z, diag(length(y))),
Klist = list(Gmatrix, Kge)
)
emmremlout$uhat

i am encountering an warning message followed by error as below
Warning in optimize(minimfunc, lower = 0, upper = 10000, tol = 1e-09) :
NA/Inf replaced by maximum positive value
Error in optim(par = rep(1/lz, lz), fn = minimfunctionouter, method = "L-BFGS-B", :
L-BFGS-B needs finite values of 'fn'
i tried to cheeck

.Machine$double.xmax
[1] 1.797693e+308

Please help me out whith the error thanks in advance