CopilotC-Nvim / CopilotC-Nvim/CopilotChat.nvim
Misleading Error on Authentication Failure "Model not found: gpt-4o"
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 171
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 1
Description
Copilot worked fine for a couple of days, until suddenly I would get the following error message: ...re/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/client.lua:440: Model not found: gpt-4o
After some looking into the logs, it showed that the cause of the problem was an issue with the curl request failing to write to disk:
[ERROR Thu Jul 10 12:22:34 2025] /home/myuyser/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:913: ...re/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/client.lua:440: Model not found: gpt-4o
[WARN Thu Jul 10 12:22:57 2025] /home/myuser/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/client.lua:396: Failed to authenticate with copilot: ...zy/CopilotChat.nvim/lua/CopilotChat/config/providers.lua:130: { "curl: (23) Failed writing received data to disk/application" }
[WARN Thu Jul 10 12:22:57 2025] /home/myuser/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/client.lua:354: Failed to authenticate with copilot: ...zy/CopilotChat.nvim/lua/CopilotChat/config/providers.lua:130: { "curl: (23) Failed writing received data to disk/application" }
[WARN Thu Jul 10 12:22:57 2025] /home/myuser/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/client.lua:359: Failed to fetch models from github_models: ...zy/CopilotChat.nvim/lua/CopilotChat/config/providers.lua:316: { "curl: (23) Failed writing received data to disk/application" }
[ERROR Thu Jul 10 12:22:57 2025] /home/myuser/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:913: ...re/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/client.lua:440: Model not found: gpt-4.1
After some digging, I was able to find the following issues that directed me to a solution:
https://github.com/CopilotC-Nvim/CopilotChat.nvim/issues/463 -> https://github.com/nvim-lua/plenary.nvim/issues/536
Solution:
Create the /run/user/1000 directory that was missing and assign it the proper permissions with sudo chown yourusername:yourusername /run/user/1000.
While this seems to be an issue with another plugin (nvim-lua/plenary.nvim), since we're using it as part of our setup for Copilot we should either suggest a solution or display the correct error so the user knows what's actually happening. In this case I believe this would be the right error to return:
[WARN Thu Jul 10 12:22:57 2025] /home/myuser/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/client.lua:396: Failed to authenticate with copilot: ...zy/CopilotChat.nvim/lua/CopilotChat/config/providers.lua:130: { "curl: (23) Failed writing received data to disk/application" } since it's the initial error in the call chain.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lua/CopilotChat/client.lua around lines 354, 396, and 440, then trace the authentication and model-fetching calls into lua/CopilotChat/config/providers.lua around lines 130 and 316. Confirm how the curl write failure becomes a misleading model-not-found error. Done means the underlying authentication or download error is surfaced instead, with coverage added if the repository has relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- authentication, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100