[GH-ISSUE #12425] Ollama completion issue #8252

Closed
opened 2026-04-12 20:46:08 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @SlareJ on GitHub (Sep 26, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12425

What is the issue?

Hi, I'm trying to configure the completion tool to work with ollama, but get this issue:

[parse] err: ...y/llm.nvim/lua/llm/common/completion/backends/ollama.lua:13: attempt to index field 'choices' (a nil value) chunk: {
  error = {
    code = vim.NIL,
    message = "registry.ollama.ai/library/qwen3:latest does not support insert",
    param = vim.NIL,
    type = "api_error"
  }
}

From the ollama logs:

[GIN] 2025/09/26 - 15:46:04 | 400 |   38.950625ms |             ::1 | POST     "/v1/completions"

Thought this might have something to do with fim, but it seems like it doesn't. I'm configuring the plugin using lazy, here's the config file:

return {
    "Kurama622/llm.nvim",
    dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", "Exafunction/windsurf.nvim", },
    cmd = { "LLMSessionToggle", "LLMSelectedTextHandler", "LLMAppHandler" },
    enabled = true,
    config = function()
        local tools = require("llm.tools")
        require("llm").setup({
            url = "127.0.0.1:11434/api/chat",
            model = "qwen3",
            api_type = "ollama",
            keys = {
                -- The keyboard mapping for the input window.
                ["Input:Submit"]      = { mode = "n", key = "<cr>" },
                ["Input:Cancel"]      = { mode = { "n", "i" }, key = "<C-c>" },
                ["Input:Resend"]      = { mode = { "n", "i" }, key = "<C-r>" },

                -- only works when "save_session = true"
                ["Input:HistoryNext"] = { mode = { "n", "i" }, key = "<C-j>" },
                ["Input:HistoryPrev"] = { mode = { "n", "i" }, key = "<C-k>" },

                -- The keyboard mapping for the output window in "split" style.
                ["Output:Ask"]        = { mode = "n", key = "i" },
                ["Output:Cancel"]     = { mode = "n", key = "<C-c>" },
                ["Output:Resend"]     = { mode = "n", key = "<C-r>" },

                -- The keyboard mapping for the output and input windows in "float" style.
                ["Session:Toggle"]    = { mode = "n", key = "<leader>ac" },
                ["Session:Close"]     = { mode = "n", key = { "<esc>", "Q" } },

                -- Scroll [default]
                ["PageUp"]            = { mode = { "i", "n" }, key = "<C-b>" },
                ["PageDown"]          = { mode = { "i", "n" }, key = "<C-f>" },
                ["HalfPageUp"]        = { mode = { "i", "n" }, key = "<C-u>" },
                ["HalfPageDown"]      = { mode = { "i", "n" }, key = "<C-d>" },
                ["JumpToTop"]         = { mode = "n", key = "gg" },
                ["JumpToBottom"]      = { mode = "n", key = "G" }
            },

            app_handler = {
                Completion = {
                    handler = tools.completion_handler,
                    opts = {
                        url = "http://localhost:11434/v1/completions",
                        model = "qwen3",
                        api_type = "ollama",
                        style = "virtual_text",
                        n_completions = 1,
                        context_window = 512,
                        max_tokens = 256,

                        filetypes = { sh = false },
                        default_filetype_enabled = true,
                        auto_trigger = true,
                        -- style = "blink.cmp",
                        -- style = "nvim-cmp",
                        -- style = "virtual_text",
                        keymap = {
                            toggle = {
                                mode = "n",
                                keys = "<leader>cp",
                            },
                            virtual_text = {
                                accept = {
                                    mode = "i",
                                    keys = "<A-a>",
                                },
                                next = {
                                    mode = "i",
                                    keys = "<A-n>",
                                },
                                prev = {
                                    mode = "i",
                                    keys = "<A-p>",
                                },
                            },
                        },
                    },
                },
            }

        })
    end,
    keys = {
        { "<leader>ac", mode = "n", "<cmd>LLMSessionToggle<cr>" },
    },
}

Would appreciate any help.

Also, is it planned to develop open-ai compatible completion tool? Because I believe it is not supported at the moment.

Relevant log output


OS

macOS

GPU

No response

CPU

Apple

Ollama version

0.12.2

Originally created by @SlareJ on GitHub (Sep 26, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12425 ### What is the issue? Hi, I'm trying to configure the completion tool to work with ollama, but get this issue: ``` [parse] err: ...y/llm.nvim/lua/llm/common/completion/backends/ollama.lua:13: attempt to index field 'choices' (a nil value) chunk: { error = { code = vim.NIL, message = "registry.ollama.ai/library/qwen3:latest does not support insert", param = vim.NIL, type = "api_error" } } ``` From the ollama logs: ``` [GIN] 2025/09/26 - 15:46:04 | 400 | 38.950625ms | ::1 | POST "/v1/completions" ``` Thought this might have something to do with fim, but it seems like it doesn't. I'm configuring the plugin using lazy, here's the config file: ```lua return { "Kurama622/llm.nvim", dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", "Exafunction/windsurf.nvim", }, cmd = { "LLMSessionToggle", "LLMSelectedTextHandler", "LLMAppHandler" }, enabled = true, config = function() local tools = require("llm.tools") require("llm").setup({ url = "127.0.0.1:11434/api/chat", model = "qwen3", api_type = "ollama", keys = { -- The keyboard mapping for the input window. ["Input:Submit"] = { mode = "n", key = "<cr>" }, ["Input:Cancel"] = { mode = { "n", "i" }, key = "<C-c>" }, ["Input:Resend"] = { mode = { "n", "i" }, key = "<C-r>" }, -- only works when "save_session = true" ["Input:HistoryNext"] = { mode = { "n", "i" }, key = "<C-j>" }, ["Input:HistoryPrev"] = { mode = { "n", "i" }, key = "<C-k>" }, -- The keyboard mapping for the output window in "split" style. ["Output:Ask"] = { mode = "n", key = "i" }, ["Output:Cancel"] = { mode = "n", key = "<C-c>" }, ["Output:Resend"] = { mode = "n", key = "<C-r>" }, -- The keyboard mapping for the output and input windows in "float" style. ["Session:Toggle"] = { mode = "n", key = "<leader>ac" }, ["Session:Close"] = { mode = "n", key = { "<esc>", "Q" } }, -- Scroll [default] ["PageUp"] = { mode = { "i", "n" }, key = "<C-b>" }, ["PageDown"] = { mode = { "i", "n" }, key = "<C-f>" }, ["HalfPageUp"] = { mode = { "i", "n" }, key = "<C-u>" }, ["HalfPageDown"] = { mode = { "i", "n" }, key = "<C-d>" }, ["JumpToTop"] = { mode = "n", key = "gg" }, ["JumpToBottom"] = { mode = "n", key = "G" } }, app_handler = { Completion = { handler = tools.completion_handler, opts = { url = "http://localhost:11434/v1/completions", model = "qwen3", api_type = "ollama", style = "virtual_text", n_completions = 1, context_window = 512, max_tokens = 256, filetypes = { sh = false }, default_filetype_enabled = true, auto_trigger = true, -- style = "blink.cmp", -- style = "nvim-cmp", -- style = "virtual_text", keymap = { toggle = { mode = "n", keys = "<leader>cp", }, virtual_text = { accept = { mode = "i", keys = "<A-a>", }, next = { mode = "i", keys = "<A-n>", }, prev = { mode = "i", keys = "<A-p>", }, }, }, }, }, } }) end, keys = { { "<leader>ac", mode = "n", "<cmd>LLMSessionToggle<cr>" }, }, } ``` Would appreciate any help. Also, is it planned to develop open-ai compatible completion tool? Because I believe it is not supported at the moment. ### Relevant log output ```shell ``` ### OS macOS ### GPU _No response_ ### CPU Apple ### Ollama version 0.12.2
GiteaMirror added the bug label 2026-04-12 20:46:08 -05:00
Author
Owner

@SlareJ commented on GitHub (Sep 26, 2025):

Posted on the wrong section, sorry

<!-- gh-comment-id:3338593671 --> @SlareJ commented on GitHub (Sep 26, 2025): Posted on the wrong section, sorry
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#8252