dpayne / CodeGPT.nvim

CodeGPT is a plugin for neovim that provides commands to interact with ChatGPT.
GNU General Public License v3.0
764 stars 50 forks source link

openSUSE curl (8.7.1) error "Failed writing received data to disk/application" #59

Open FvD opened 5 months ago

FvD commented 5 months ago

As I'm trying to get this configured I've run into the following issue after any :Chat call:

Error: post https://api.openai.com/v1/chat/completions - curl error exit_code=23 
stderr={ "curl: (23) Failed writing received data to disk/application" }.

What else could be happening?

dpayne commented 5 months ago

Do you have the snap version of curl installed?

FvD commented 5 months ago

Thank you for your reply. I checked (using snap list and flatpak list), and I can confirm that is was not installed through one of those but through my package manager (zypper - i'm on OpenSuse Tumbleweed). Also: which curl shows /usr/bin/curl.

Saving something directly with curl works.

 ❯ curl example.com -o example.txt
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1256  100  1256    0     0  10939      0 --:--:-- --:--:-- --:--:-- 11017

I checked further to make sure that it has nothing to do with using the nvim app.image - but aparently not - the error persists when I install neovim with the OS package manager. And i tried some increasing the timeout in .curlr and piping curl output to a file - the output is written there, but does not include openai output. As soon as I can I'll try on a VM with a different OS to see if this is specific to OpenSuse.

This is the error in curl CURLOPT_WRITEFUNCTION. But i still have not been able to figure out where codgpt.nvim is trying to write to.

dpayne commented 4 months ago

Unfortunately I have not been able to reproduce it.

FvD commented 4 months ago

Thank you for trying to reproduce @dpayne. I tested it on an Ubuntu 24 LTS (curl 8.5.0) and it worked without issue. On a clean openSUSE Tumbleweed VM(curl 8.7.1) it gave the same error message. So maybe it is a curl issue.

I tried to downgrade curl on openSUSE, but there are just too many dependencies to make that feasible. Likewise I have not yet increased the curl version on Ubuntu to see if the error can be reproduced that way.

Maybe someone will answer on the openSUSE Forum (https://forums.opensuse.org/t/curl-8-7-1-not-working-in-neovim/175443)

nmnduy commented 3 weeks ago

I had the same problem on debian 12. updating curl to 8.9.1-2 fixed it.

gytis-ivaskevicius commented 1 week ago

Same issue on NixOS, sounds like its some sort of race condition

The issue is somewhere in the plenary plugin, good place to start is logging the command here

If I had to guess, these readers should be set up before spawning the process

I would appreciate if someone could play around with it, not sure when Ill have time for it