Skip to content

Cannot deepcopy object of type userdata #331

@mike-lloyd03

Description

@mike-lloyd03

I just installed and when opening the opencode window, I get this error:

Error executing vim.schedule lua callback: vim/shared.lua:0: Cannot deepcopy object of type userdata                                                                                                           
stack traceback:                                                                                                                                                                                               
        [C]: in function 'error'                                                                                                                                                                               
        vim/shared.lua: in function ''                                                                                                                                                                         
        vim/shared.lua: in function ''                                                                                                                                                                         
        vim/shared.lua: in function ''                                                                                                                                                                         
        vim/shared.lua: in function 'deepcopy'                                                                                                                                                                 
        ...are/nvim/lazy/opencode.nvim/lua/opencode/state/store.lua:213: in function 'mutate'                                                                                                                  
        ...hare/nvim/lazy/opencode.nvim/lua/opencode/state/jobs.lua:41: in function 'set_server_port'                                                                                                          
        ...hare/nvim/lazy/opencode.nvim/lua/opencode/server_job.lua:296: in function 'fn'                                                                                                                      
        ...ocal/share/nvim/lazy/opencode.nvim/lua/opencode/util.lua:395: in function <...ocal/share/nvim/lazy/opencode.nvim/lua/opencode/util.lua:394> 

My config:

    {
        "sudo-tee/opencode.nvim",
        config = function()
            require("opencode").setup({
                keymap_prefix = "<space>v",
            })
        end,
        dependencies = {
            "nvim-lua/plenary.nvim",
            {
                "MeanderingProgrammer/render-markdown.nvim",
                opts = {
                    anti_conceal = { enabled = false },
                    file_types = { "markdown", "opencode_output" },
                },
                ft = { "markdown", "Avante", "copilot-chat", "opencode_output" },
            },
            "saghen/blink.cmp",
            "folke/snacks.nvim",
        },
    },

After clearing the error, sending chats to the agent does nothing. The text in the input box disappears.

PS, Is there a reason it is suggested to use config = function() require("opencode").steup... and not just Lazy's opts field?

On NVIM v0.11.6 and Linux 6.19.6-arch1-1 and opencode 1.2.15.

Thanks for the cool plug! I can't wait to use it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions