Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl: (23) Failed writing received data to disk/application #315

Closed
dbarrosop opened this issue Aug 28, 2024 · 12 comments
Closed

curl: (23) Failed writing received data to disk/application #315

dbarrosop opened this issue Aug 28, 2024 · 12 comments

Comments

@dbarrosop
Copy link

Hello,
I am trying this plugin which looks very promising but after setting it up I am getting the following error:

- Datetime: 2024-08-28 13:03:05

- Model: claude/claude-3-5-sonnet-20240620

> hello

🔄 **Generating response ...**


🚨 Error: {
  exit = 23,
  message = 'post https://api.anthropic.com/v1/messages - curl error exit_code=23 stderr={ "curl: (23) Failed writing received data to disk/application" }',
  stderr = '{ "curl: (23) Failed writing received data to disk/application" }'
}

Looks like curl is trying to write something to disk and doesn't have permissions. I tried changing the setting history.storage_path but same issue. Do you know what this plugin is trying to write to disk, where and how to change it?

In case it helps I am running this on MacOS and I installed neovim using nix and looks like using sudo works (which confirms it is a permission issue I guess).

Thanks!

@MathieuTuli
Copy link

+1

@aarnphm
Copy link
Collaborator

aarnphm commented Aug 28, 2024

what curl version are you using? there was an issue about curl 8.7 or sth similar afaik.

@MathieuTuli
Copy link

MathieuTuli commented Aug 28, 2024

I had seen that, I just tried updating to 8.9.1 but no change. I had 8.1.2 before and the issue persisted.

Note I used to use my own simple llm plugin and use curl just fine in a very similar manner to this plugin, so I know with reasonable confidence it's not curl (version), unless there's specific piping going on that is obfuscated. Will dig further.

@dbarrosop
Copy link
Author

I am using curl 8.7.1 but in my case if I start nvim with sudo it works fine so I suspect it is a permissions issue. Is the history the only thing being written to disk? I can see the folder being created but no files written when running nvim, with sudo nvim I can see the history files being written.

@scmeek
Copy link

scmeek commented Aug 28, 2024

I'm also seeing this issue. I'm using openai and have confirmed curling requests outside of neovim & avante work as expected. I tried updating curl as well and am still seeing the issue.

@dbarrosop
Copy link
Author

Seems related nvim-lua/plenary.nvim#536

@MathieuTuli
Copy link

@dbarrosop from what I gather the command fails before even getting to the history save, so I don't think that's it. Permissions on the state folder defined by storage_path seem okay so I don't think it's a permission issue there.

It's the Llm.stream() call that's failing, and falling back to on_error - it would ideal to get a print out of the exact curl command so I could test/see what may be going on. I suspect it may be from trying to stream the curl response, which is perhaps piping data to another command this permission error.

@dbarrosop
Copy link
Author

dbarrosop commented Aug 28, 2024

Ok, I think I figured it out. So the issue is that the curl method is using $XDG_RUNTIME_DIR, which in my case was set to /run/user/501 which didn't exist. Just for the sake of trying I tried to set it to /tmp/run/user/501 but same issue. Finally, I created the folder with mkdir -p /tmp/run/user/501 and now everything works.

@MathieuTuli
Copy link

MathieuTuli commented Aug 28, 2024

@dbarrosop yeah it seems plenary on MacOs, or some set of config, causes it to look there instead of the default /tmp. This also works as a fix.

export XDG_RUNTIME_DIR="/tmp/"

Which you can set in your .zshrc or something. I recommend doing this as folders in /tmp are not guaranteed to be persistent.

This is most likely a plenary issue.

@dbarrosop
Copy link
Author

I ended up setting it to $TMPDIR as I am using nix and my $TMPDIR is actually different from /tmp.

In any case, maybe this can be closed.

Thanks a lot for the help and the plugin.

@scmeek
Copy link

scmeek commented Aug 28, 2024

@dbarrosop yeah it seems plenary on MacOs, or some set of config, causes it to look there instead of the default /tmp. This also works as a fix.

export XDG_RUNTIME_DIR="/tmp/"

Which you can set in your .zshrc or something. I recommend doing this as folders in /tmp are not guaranteed to be persistent.

This is most likely a plenary issue.

This worked for me as well.

@aarnphm
Copy link
Collaborator

aarnphm commented Aug 30, 2024

I wil reference this into the wiki. will close it as it doesn't seem like it is related to the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants