zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.27k stars 2.98k forks source link

Crashing because folder github-copilot doesn't exist #17501

Closed Madscientiste closed 1 week ago

Madscientiste commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Just barely cloned the repo i haven't done anything particular, here is what i've done:

Environment

Attribute Details
OS Ubuntu 22.04.4 LTS on Windows 10
Kernel 5.15.153.1-microsoft-standard-WSL2
Uptime 5 hours, 33 mins
Packages 1316 (dpkg), 8 (snap)
Shell zsh 5.8.1
Theme Adwaita [GTK3]
Icons Adwaita [GTK3]
Terminal vscode
CPU Intel Ultra 7 155H (22) @ 2.995GHz
GPU 8a9b:00:00.0 Microsoft Corporation Device 008a
Memory 8807MiB / 15707MiB
Disk (/) 152G / 1007G (16%)
Font Cantarell 11 [GTK3]

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

[2024-09-06T15:42:54+02:00 ERROR fs] No such file or directory (os error 2) about ["/home/username/.config/github-copilot"]

Stack backtrace:
   0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
             at /home/username/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.86/src/backtrace.rs:27:14
   1: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/result.rs:1989:27
   2: <fs::RealWatcher as fs::Watcher>::add
             at ./crates/fs/src/fs.rs:660:12
   3: <fs::RealFs as fs::Fs>::watch::{{closure}}
             at ./crates/fs/src/fs.rs:538:13
   4: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/future/future.rs:123:9
   5: settings::settings_file::watch_config_file::{{closure}}
             at ./crates/settings/src/settings_file.rs:42:75
   6: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/future/future.rs:123:9
   7: async_task::raw::RawTask<F,T,S,M>::run
             at /home/username/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.1/src/raw.rs:557:17
   8: async_task::runnable::Runnable<M>::run
             at /home/username/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-task-4.7.1/src/runnable.rs:781:18
   9: gpui::platform::linux::dispatcher::LinuxDispatcher::new::{{closure}}::{{closure}}
             at ./crates/gpui/src/platform/linux/dispatcher.rs:44:25
  10: std::sys::backtrace::__rust_begin_short_backtrace
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:152:18
  11: std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/mod.rs:538:17
  12: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panic/unwind_safe.rs:272:9
  13: std::panicking::try::do_call
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
  14: __rust_try
  15: std::panicking::try
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
  16: std::panic::catch_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
  17: std::thread::Builder::spawn_unchecked_::{{closure}}
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/thread/mod.rs:537:30
  18: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  19: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  21: std::sys::pal::unix::thread::Thread::new::thread_start
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/pal/unix/thread.rs:108:17
  22: <unknown>
  23: <unknown>
Madscientiste commented 1 month ago

I have found the issue and fixed it, basically creating the folder if missing; should i open a PR ?

notpeter commented 1 month ago

Happy to review PRs.

Madscientiste commented 1 month ago

@notpeter its there

Thanks !

maxdeviant commented 1 month ago

@Madscientiste Could you include the commit SHA that you saw this on?

maxdeviant commented 1 month ago

In the Linux file watcher implementation we already ignore errors when adding the file to the watcher:

https://github.com/zed-industries/zed/blob/2d06d5c9061bf089657e87addc0bbd537c430d16/crates/fs/src/fs.rs#L588-L593

We do log the error here, though, which would put it in the logs (and with RUST_BACKTRACE=1 it would include the backtrace in the log).

@Madscientiste Are you sure that this error is the one responsible for the crash?

Madscientiste commented 1 month ago

I'll do another test once i get home, but yes the log you are seeing in the issue is the logs produced when is RUST_BACKTRACE set

There is something else going on i think.

I forgot to mention this, I'm using a X11 server and not WSLg

Madscientiste commented 1 month ago

Okay, so i've been trying to understand what happened and why this made crash.

Firstly zed didn't crash, turns out it was WSLg/X11 just doing weird things; the error itself was harmless just i thought it was the issue on why it wasn't starting.

Then on why fixing the creation of the folder fixed my issue, well it didn't since it was a WSL thing all along ... Basically i didn't pay enough attention as i modified a env variable inside a session, and ran zed on another session which made it look like it was doing nothing ...

I have to pay more attention on what i'm doing to avoid wasting time like this.

Sorry guys !


Question:

notpeter commented 1 week ago

I'm closing because I think you've sorted your issue, if not please comment with more details and we can reopen.

For anyone who finds this issue because the see the copilot error in their logs, the issue for tracking that is here: