ChatGPT.nvim icon indicating copy to clipboard operation
ChatGPT.nvim copied to clipboard

ChatGPT plugin error luca callback error

Open mPanasiewicz opened this issue 2 years ago • 1 comments

Hello,

Did anyone get this error?

Error executing Lua callback: vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'tbl_deep_extend'
        .../pack/packer/start/ChatGPT.nvim/lua/chatgpt/settings.lua:70: in function 'get_settings_panel'
        ...ack/packer/start/ChatGPT.nvim/lua/chatgpt/code_edits.lua:83: in function 'edit_with_instructions'
        ...nvim/site/pack/packer/start/ChatGPT.nvim/lua/chatgpt.lua:33: in function 'edit_with_instructions'
        ...m/site/pack/packer/start/ChatGPT.nvim/plugin/chatgpt.lua:10: in function <...m/site/pack/packer/start/ChatGPT.nvim/plugin/chatgpt.lua:9>

Thank you

image

mPanasiewicz avatar Mar 17 '23 14:03 mPanasiewicz

I'm getting an error as well but not the same one

Error executing Lua callback: ...k/.local/share/nvim/lazy/ChatGPT.nvim/plugin/chatgpt.lua:2: loop or previous error loading module 'chatgpt'
stack traceback:
        [C]: in function 'require'
        ...k/.local/share/nvim/lazy/ChatGPT.nvim/plugin/chatgpt.lua:2: in function <...k/.local/share/nvim/lazy/ChatGPT.nvim/plugin/chatgpt.lua:1>
Press ENTER or type command to continue

This is occurring in the plugins/chatgpt.lua file when trying to require('chatgpt').openChat(). This require is failing, any idea how to fix this? @jackMort

Will be very helpful if you can take a look

2KAbhishek avatar Mar 17 '23 20:03 2KAbhishek

I have this issue also. @mPanasiewicz did you fix it somehow? I have no custom config, and have only copy pasted the packer snippet to install and then compile.

johnmathews avatar Apr 03 '23 09:04 johnmathews

Also getting this issue.

AlexvZyl avatar Apr 03 '23 21:04 AlexvZyl

+1

NickyTope avatar Apr 03 '23 22:04 NickyTope

Please share your setup, i need more details to be able to help

jackMort avatar Apr 04 '23 04:04 jackMort

my setup using Lazy:

return {
  "jackMort/ChatGPT.nvim",
  setup = function()
    require("chatpgt").setup({})
  end,
  dependencies = {
    "MunifTanjim/nui.nvim",
    "nvim-lua/plenary.nvim",
    "nvim-telescope/telescope.nvim",
  },
}

Error when running :ChatGPT

Error executing Lua callback: vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
	[C]: in function 'error'
	vim/shared.lua: in function 'validate'
	vim/shared.lua: in function 'tbl_deep_extend'
	...al/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/settings.lua:70: in function 'get_settings_panel'
	...ocal/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/module.lua:67: in function 'open_chat'
	...ocal/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/module.lua:280: in function 'openChat'
	...icky/.local/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt.lua:25: in function 'openChat'
	...y/.local/share/nvim/lazy/ChatGPT.nvim/plugin/chatgpt.lua:2: in function <...y/.local/share/nvim/lazy/ChatGPT.nvim/plugin/chatgpt.lua:1>

This is on Neovim nightly, specifically:

NVIM v0.9.0-dev-1318+g53f36806f Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

NickyTope avatar Apr 04 '23 04:04 NickyTope

Error when running :ChatGPTCompleteCode:

Error executing Lua callback: vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
	[C]: in function 'error'
	vim/shared.lua: in function 'validate'
	vim/shared.lua: in function 'tbl_extend'
	.../.local/share/nvim/lazy/ChatGPT.nvim/lua/chatgpt/api.lua:18: in function 'completions'
	...ChatGPT.nvim/lua/chatgpt/flows/code_completions/init.lua:54: in function 'complete_code'
	...y/.local/share/nvim/lazy/ChatGPT.nvim/plugin/chatgpt.lua:40: in function <...y/.local/share/nvim/lazy/ChatGPT.nvim/plugin/chatgpt.lua:39>

NickyTope avatar Apr 04 '23 04:04 NickyTope

Thanks @NickyTope , I'm using packer and tested it only for it, but going to do the same with lazy to make sure it works

jackMort avatar Apr 04 '23 05:04 jackMort

Please share your setup, i need more details to be able to help

I am using packer with the default setup.

AlexvZyl avatar Apr 04 '23 08:04 AlexvZyl

Please share your setup, i need more details to be able to help

I am also using packer with the default setup. Nvim 0.8.2.

    use({
      "jackMort/ChatGPT.nvim",
      config = function()
        require("chatgpt").setup({
          -- optional configuration
        })
      end,
      requires = {
        "MunifTanjim/nui.nvim",
        "nvim-lua/plenary.nvim",
        "nvim-telescope/telescope.nvim"
      }
    })

oh wait, when i remove the comment, and the empty table, it works.

Config should be:

    use({
      "jackMort/ChatGPT.nvim",
      config = function()
        require("chatgpt").setup()
      end,
      requires = {
        "MunifTanjim/nui.nvim",
        "nvim-lua/plenary.nvim",
        "nvim-telescope/telescope.nvim"
      }
    })

johnmathews avatar Apr 04 '23 08:04 johnmathews

I updated the readme to include instructions for Lazy as well, please make sure you have OPENAI_API_KEY set properly and it should works, I've tested it on multiple setups

jackMort avatar Apr 04 '23 09:04 jackMort