zed icon indicating copy to clipboard operation
zed copied to clipboard

Copilot can't be started: oneshot canceled

Open spaceunifyfifty opened this issue 1 year ago • 9 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Github Copilot no longer works for me in Zed. I see that is inactive, and click "sign-in" . After a few moments, I see an error popup

Copilot can't be started: oneshot canceled image

I have tried:

  • clicking Reinstall copilot
  • resigning into my github account
  • reinstalling zed (via brew)

without success

Environment

Zed: v0.136.2 (Zed) OS: macOS 14.2.1 Memory: 8 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

[INFO] Node runtime install_if_needed
[INFO] starting language server. binary path: "/Users/john/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/node", 
working directory: "/", args: ["/Users/john/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
[ERROR] crates/lsp/src/lsp.rs:357: cannot read LSP message headers
[ERROR] crates/lsp/src/lsp.rs:379: Broken pipe (os error 32)
[ERROR] crates/lsp/src/lsp.rs:773: server shut down

and I have also seen before:

[ERROR] crates/inline_completion_button/src/inline_completion_button.rs:493: copilot hasn't started yet

spaceunifyfifty avatar May 23 '24 08:05 spaceunifyfifty

Following https://github.com/zed-industries/zed/issues/6954 I have attempted to solve this by

  1. uninstall zed from brew
brew uninstall zed
brew cleanup -s
  1. remove copilot related cache
rm -rf ~/.config/github-copilot
rm -rf ~/Library/Application\ Support/Zed/copilot
  1. manually install zed from the official aarch64 .dmg from https://zed.dev/download

The issue persists; copilot will not turn on.

spaceunifyfifty avatar May 23 '24 08:05 spaceunifyfifty

Did this just start happening with a specific version, @spaceunifyfifty?

JosephTLyons avatar May 24 '24 17:05 JosephTLyons

Did this just start happening with a specific version, @spaceunifyfifty?

I am not sure. I feel like I first noticed this a few weeks ago.

spaceunifyfifty avatar May 25 '24 07:05 spaceunifyfifty

same here. Tried reinstalling the app and clearing ~/.config/github-copilot & Application Support/, but no effect. Any news on this @spaceunifyfifty @JosephTLyons ?

mdugue avatar Jun 14 '24 07:06 mdugue

I'm facing the same issue on a linux build

jpshall avatar Jun 19 '24 05:06 jpshall

@JosephTLyons any update on this or recommended steps to fix? Still do not have copilot working.

spaceunifyfifty avatar Jul 11 '24 06:07 spaceunifyfifty

is there any updates on this? I got the same issue on NixOS

vec715 avatar Jul 11 '24 21:07 vec715

is there any updates on this? I got the same issue on NixOS

some info from the console when trying to sign in to copilot:

2024-07-12T03:42:28+03:00 ERROR util] crates/lsp/src/lsp.rs:357: cannot read LSP message headers
[2024-07-12T03:42:28+03:00 ERROR util] crates/inline_completion_button/src/inline_completion_button.rs:493: copilot hasn't started yet
[2024-07-12T03:42:28+03:00 ERROR util] crates/lsp/src/lsp.rs:773: server shut down
[2024-07-12T03:42:28+03:00 ERROR util] crates/lsp/src/lsp.rs:379: Broken pipe (os error 32)

vec715 avatar Jul 12 '24 00:07 vec715

I'm having the same issue running NixOS, Zed 0.141.3.

stromseng avatar Jul 14 '24 10:07 stromseng

I have this issue on Arch Linux, running preview 144.2.

EDIT: I was able to fix this problem by deleting ~/.local/share/zed/node/node-v18.15.0-linux-x64/bin/node and instead symlinking /usr/bin/node in it's place. Doing this allowed copilot to connect with out Node shutting down.

cd ~/.local/share/zed/node/node-v18.15.0-linux-x64/bin && rm ./node && ln -s /usr/bin/node ./node

EDIT 2: This seems to have resolved many other problems, including the JSON LSP never working (for settings.json).

143mailliw avatar Jul 16 '24 05:07 143mailliw

@143mailliw

Glad you got it working. If anyone finds an analogous solution for MacOS please post.

spaceunifyfifty avatar Jul 21 '24 09:07 spaceunifyfifty

i made a script for this because my node wasn't at /usr/bin/node https://gist.github.com/dezren39/234c8693555fba7d4234f147da5a7553

dezren39 avatar Jul 24 '24 03:07 dezren39

For nixos user having this issue, doing this worked for me: 1: Delete the node provided by zed:

rm .local/share/zed/node/node-v22.5.1-linux-x64/bin/node

2: Symlink the node path, for my system I used:

ln -s ~/.nix-profile/bin/node ./node

Special thanks to @143mailliw for the idea

k3yss avatar Aug 30 '24 21:08 k3yss

@k3yss this works, but is it rebuild safe? Is there a better way of doing this via configuration.nix rather than running the commands manually

WillsterJohnson avatar Sep 22 '24 17:09 WillsterJohnson

but is it rebuild safe?

I think so, as I have been using this for the past few revision.

Is there a better way of doing this via configuration.nix rather than running the commands manually

There is a new zed-fhs in the nixpkgs-unstable maybe that solves the problem, although I have yet to test it.

cc https://github.com/NixOS/nixpkgs/issues/309662

k3yss avatar Sep 22 '24 18:09 k3yss

but is it rebuild safe?

I think so, as I have been using this for the past few revision.

Is there a better way of doing this via configuration.nix rather than running the commands manually

There is a new zed-fhs in the nixpkgs-unstable maybe that solves the problem, although I have yet to test it.

cc NixOS/nixpkgs#309662

I just tried to search for zed-fhs on unstable channel and there is no such package

vec715 avatar Sep 23 '24 22:09 vec715

@vec715 I think if you the original package zed it has the fhs features builtin, take a look at this https://github.com/NixOS/nixpkgs/pull/339852

k3yss avatar Sep 23 '24 22:09 k3yss

I believe it may be related to stale node configurations and for some users, issues with node18, but without steps to reproduce I'm going to go ahead close this as unactionable.

To troubleshoot this you may wish to verify explicitly what version of node Zed is using. Check your PATH and which node / which npm, and ps aux |grep copilot. For example, I briefly experienced this issue while I had a non-default node18 installation temporarily configured in my path. Node 18 is already EOL (security updates only) and will be completely unsupported on 2025-04-30.

If you are experiencing this with a current zed release and node >= 20 please open a clean issue with as many details as possible so we can best try and troubleshoot and reproduce exactly what you are seeing.

notpeter avatar Feb 26 '25 15:02 notpeter

After updating to v0.180.2, I encountered the same error: "oneshot canceled".

Here are the logs:

2025-04-02T23:13:58.618953+03:00 [INFO] starting language server process. binary path: "/usr/local/bin/node", working directory: "/", args: ["/Users/user/Library/Application Support/Zed/copilot/node_modules/@github/copilot-language-server/dist/language-server.js", "--stdio"]
2025-04-02T23:13:58.659705+03:00 [ERROR] cannot read LSP message headers
2025-04-02T23:13:58.659841+03:00 [ERROR] Broken pipe (os error 32)
2025-04-02T23:13:58.659928+03:00 [ERROR] server shut down

I ran the command manually to investigate:

"/usr/local/bin/node" "/Users/user/Library/Application Support/Zed/copilot/node_modules/@github/copilot-language-server/dist/language-server.js" --stdio

And got this output:

Node.js 20.x is required to run GitHub Copilot but found 19.0.0

So the issue was that Copilot's language server requires Node.js 20.x, but my /usr/local/bin/node pointed to Node.js 19.

Even though I had Node.js 22 installed via nvm, Zed was still using the old system path. To fix it, I updated the symlink to point to my active Node.js version:

ln -sf $(which node) /usr/local/bin/node

Or you can simply update the Node.js version installed at /usr/local/bin/node to 20.x or higher.

After that, everything worked again.

vantuh avatar Apr 02 '25 20:04 vantuh

See also:

  • https://github.com/zed-industries/zed/issues/27908

Which will be fixed by:

  • https://github.com/zed-industries/zed/pull/27912

notpeter avatar Apr 02 '25 21:04 notpeter