Skip to content

Misleading Error on Authentication Failure "Model not found: gpt-4o" #1184

@Bickor

Description

@Bickor

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:
#463 -> nvim-lua/plenary.nvim#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions