Exafunction / codeium.nvim

A native neovim extension for Codeium
MIT License
644 stars 50 forks source link

completion source error #122

Closed BirdeeHub closed 7 months ago

BirdeeHub commented 7 months ago

EDIT: further testing reveals that it started throwing this error after 822e762567a0bf50b1a4e733c8c93691934d7606 because this commit works great for me. For now I have pinned my flake input to this commit.

The above commit works great with no erros.

The commit: 1b87c86686fe65561cf993f9bb06dad3c56184e0 is when the errors started

when I have codeium enabled as a completion source for cmp, it is causing plenary log.lua to throw an error saying ~/.cache/birdeevim/codeium is a directory. But it is meant to be a directory, no? Inside that directory is the config.json that contains your auth and stuff. So why is it being a directory causing an error to be thrown whenever I type fast? but only sometimes?

My cache directory is currently birdeevim because I have NVIM_APPNAME environment variable set, but it happens whether I have the variable set or not, if it isnt set it says the same warning but nvim instead of birdeevim. I have only tested downloading it through nix so far because I dont want to make an entire regular setup to test this. Why is this? Its pretty unuseable I had to disable it.

The error is this

completion request failed
completion request failed
Error executing vim.schedule lua callback: .../myNeovimPackages/start/plenary.nvim/lua/plenary/log.lua:166: /home/birdee/.cache/birdeevim/codeium: Is a directory
stack traceback:
        [C]: in function 'assert'
        .../myNeovimPackages/start/plenary.nvim/lua/plenary/log.lua:166: in function 'warn'
        .../pack/myNeovimPackages/start/codeium/lua/codeium/api.lua:275: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue
[codeium] [WARN  00:39:44] /nix/store/9vw89w5f6dnnw2l82m8x0q9lcgj16kz4-vim-pack-dir/pack/myNeovimPackages/start/codeium/lua/codeium/api.lua:275: failed to cancel in-flight request {
Press ENTER or type command to continue
[codeium]   code = 0,
Press ENTER or type command to continue
[codeium]   out = '{"code":"unknown","message":"no session state for apiKey *****************, sessionId "}',
Press ENTER or type command to continue
[codeium]   response = {
Press ENTER or type command to continue
[codeium]     body = '{"code":"unknown","message":"no session state for apiKey ******************, sessionId "}',
Press ENTER or type command to continue
[codeium]     exit = 0,
Press ENTER or type command to continue
[codeium]     headers = { "Accept-Encoding: gzip", "Content-Type: application/json", "Vary: Origin", "Date: Wed, 29 Nov 2023 08:39:43 GMT", "Content-Length: 107", "", "" },
Press ENTER or type command to continue
[codeium]     status = 500
Press ENTER or type command to continue
[codeium]   },
Press ENTER or type command to continue

Error executing vim.schedule lua callback: .../myNeovimPackages/start/plenary.nvim/lua/plenary/log.lua:166: /home/birdee/.cache/birdeevim/codeium: Is a directory
stack traceback:
        [C]: in function 'assert'
        .../myNeovimPackages/start/plenary.nvim/lua/plenary/log.lua:166: in function <.../myNeovimPackages/start/plenary.nvim/lua/plenary/log.lua:121>
        ...ck/myNeovimPackages/start/codeium/lua/codeium/notify.lua:14: in function 'error'
        .../pack/myNeovimPackages/start/codeium/lua/codeium/api.lua:310: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue
[codeium] [ERROR 00:50:41] /nix/store/9vw89w5f6dnnw2l82m8x0q9lcgj16kz4-vim-pack-dir/pack/myNeovimPackages/start/codeium/lua/codeium/notify.lua:14: completion request failed:  {
Press ENTER or type command to continue
[codeium]   code = 0,
Press ENTER or type command to continue
[codeium]   out = '{"code":"resource_exhausted","message":"rpc error: code = ResourceExhausted desc = Cannot handle more concurrent completion requests."}',
Press ENTER or type command to continue
[codeium]   response = {
Press ENTER or type command to continue
[codeium]     body = '{"code":"resource_exhausted","message":"rpc error: code = ResourceExhausted desc = Cannot handle more concurrent completion requests."}',
Press ENTER or type command to continue
[codeium]     exit = 0,
Press ENTER or type command to continue
[codeium]     headers = { "Accept-Encoding: gzip", "Connect-Accept-Encoding: gzip", "Connect-Content-Encoding: gzip", "Connection: keep-alive", "Content-Type: application/json", "Date: Wed, 29 Nov 2023 08:39:43 GM
T", "Strict-Transport-Security: max-age=15724800; includeSubDomains", "Vary: Origin", "Vary: Origin", "Content-Length: 135", "", "" },
Press ENTER or type command to continue
[codeium]     status = 429
Press ENTER or type command to continue
[codeium]   },

for completeness's sake, this is how I configured it

EDIT: currently I have it pinned to the last working commit now that I found it. Nothing else related to this plugin has changed.

https://github.com/BirdeeHub/birdeevim

You can see where I add it in flake.nix, and then where I call require codeium and also add it to cmp in lua/birdee/plugins/completion.lua

I have my AI auth thing in lua/birdee/AI.lua and it grabs from my bitwarden, but regardless of how I auth, either using AI.lua or doing it normall, it throws this error, but only when I type too fast, or too soon after opening a document.

The lsp just gets exported to the path for neovim, the other gets added to startup plugins, it has cmp and plenary in startup plugins as well, so what gives? It works up until I type too fast and then it throws an error like that....

Installing it via this method worked for 2-3 weeks, and then just stopped working as well about a week or 2 ago, and over the last few days its been unbearable.

I should add, it throws these errors with this setup (before I locked to the commit) on manjaro and nixos on baremetal, as well as an ubuntu running on wsl. Oh, and my kali vm.

balford-hub commented 7 months ago

I'm getting identical errors in identical circumstances with a much more standard install. Mine is just added to my plugin list and cmp sources, no other modifications from the default. Started getting these errors during commit 1b87c86, newest commit (fd9c903) didn't fix it.

BirdeeHub commented 7 months ago

for now, I have pinned it to 822e762567a0bf50b1a4e733c8c93691934d7606 in my flake inputs until this is fixed

codeium.url = "github:Exafunction/codeium.nvim/822e762567a0bf50b1a4e733c8c93691934d7606";
balford-hub commented 7 months ago

Thanks for the url! I'm using Lazy plugin manager, so I just added a commit tag in the loading script.

BirdeeHub commented 7 months ago

If you ever want to swap to the nix dark side, the repo I linked here imports this one

https://github.com/BirdeeHub/nixCats-nvim

Which is a kickstarter for moving your nvim setup to nix and taking advantage of all the features of nixOS without sacrificing your sanity trying to write a bunch of lua within nix strings where neodev wouldnt work. The one I linked in the original issue is my personal config, which actually just imports nixCats and uses the builder and some other stuff from it to make its own thing without needing to duplicate a bunch of stuff.

pqn commented 7 months ago

Closing this issue as a duplicate of #121, with the root cause being an update to plenary.nvim: https://github.com/Exafunction/codeium.nvim/issues/121#issuecomment-1831026074

pqn commented 7 months ago

Linking directly to the fix for the directory issue here for convenience: https://github.com/Exafunction/codeium.nvim/issues/121#issuecomment-1832819652