nomnivore / ollama.nvim

A plugin for managing and integrating your ollama workflows in neovim.
MIT License
311 stars 22 forks source link

Error text appears every time I do anything #30

Open mclarkson opened 2 months ago

mclarkson commented 2 months ago

I had error text about a job being undefined every time I tried to do anything, then the window would appear and things would work once I accepted the error message. I updated to latest neovim and lunarvim (since I'm using lunarvim) but it didn't seem to help.

Actual error:

E5108: Error executing lua ...arvim/site/pack/lazy/opt/ollama.nvim/lua/ollama/init.lua:294: attempt to index local 'job' (a nil value)

To fix this I had to add, at line 294:

if job == nil then
    return
end

so it looks like:

    })
    ---@param j Job
    if job == nil then
        return
    end
    job:add_on_exit_callback(function(j)
        if stream_called then
            return
        end

Then the errors stopped.

This plugin is fantastic by the way, thank you!!

nomnivore commented 1 month ago

Are you still having this issue? Neovim or neovim nightly?

Job really shouldn't be nil here, because it's being defined by the plenary curl method just above. I'm curious how it is both not recognizing the job object yet still seems to be working?