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.58k stars 3.04k forks source link

Zed crashes when git repo is moved #7214

Closed kevinamstutz closed 9 months ago

kevinamstutz commented 9 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Zed crashes under the following circumstances:

  1. Open Zed.
  2. Open a git repository, let's say ~/projects/some_repo.
  3. Open a terminal in Zed.
  4. Rip out and replace the repo:
    cd ~/projects
    mv ~/projects/some_repo ~/projects/some_repo_old
    git clone git@github.com/someuser/some_repo
  5. Click on one of the files to view in Zed.
  6. Zed crashes.

Environment

Zed: v0.120.5 (Zed) OS: macOS 14.3.0 Memory: 128 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.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

2024-02-01T13:56:04 [INFO] 0 unhandled notification LogMessage: { "level": 1, "message": "[INFO] [streamChoices] [2024-02-01T13:56:04.845Z] solution 0 returned. finish reason: [stop]", "metadataStr": "[INFO] [streamChoices] [2024-02-01T13:56:04.845Z]", "extra": [ "solution 0 returned. finish reason: [stop]" ] } 2024-02-01T13:56:04 [INFO] 0 unhandled notification LogMessage: { "level": 1, "message": "[INFO] [streamChoices] [2024-02-01T13:56:04.846Z] request done: headerRequestId: [716608fb-3239-4c5a-8f77-4ea40d7fc068] model deployment ID: [wff3825c15dfa]", "metadataStr": "[INFO] [streamChoices] [2024-02-01T13:56:04.846Z]", "extra": [ "request done: headerRequestId: [716608fb-3239-4c5a-8f77-4ea40d7fc068] model deployment ID: [wff3825c15dfa]" ] } 2024-02-01T13:56:05 [INFO] 0 unhandled notification LogMessage: { "level": 1, "message": "[INFO] [ghostText] [2024-02-01T13:56:05.013Z] Found inline suggestions locally", "metadataStr": "[INFO] [ghostText] [2024-02-01T13:56:05.013Z]", "extra": [ "Found inline suggestions locally" ] } 2024-02-01T13:57:27 [INFO] reload git repository ".git" 2024-02-01T13:57:55 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:57:56 [INFO] reload git repository ".git" 2024-02-01T13:58:09 [INFO] reload git repository ".git" 2024-02-01T13:58:13 [INFO] reload git repository ".git" 2024-02-01T13:58:14 [INFO] reload git repository ".git" 2024-02-01T13:58:16 [INFO] reload git repository ".git" 2024-02-01T13:58:17 [INFO] reload git repository ".git" 2024-02-01T13:58:19 [INFO] reload git repository ".git" 2024-02-01T13:58:20 [INFO] reload git repository ".git" 2024-02-01T13:58:53 [INFO] reload git repository ".git" 2024-02-01T13:58:55 [INFO] reload git repository ".git" 2024-02-01T13:58:55 [INFO] reload git repository ".git" 2024-02-01T13:58:55 [INFO] reload git repository ".git" 2024-02-01T13:59:05 [INFO] reload git repository ".git" 2024-02-01T13:59:27 [ERROR] failed to canonicalize root path: No such file or directory (os error 2) 2024-02-01T13:59:27 [ERROR] failed to canonicalize root path: No such file or directory (os error 2) 2024-02-01T13:59:36 [INFO] build git repository ".git" 2024-02-01T13:59:36 [ERROR] crates/fs/src/fs.rs:272: Error { code: -3, klass: 6, message: "could not find repository from '/Users/kamstut/Dropbox/projects/containers/.git'" } 2024-02-01T13:59:36 [INFO] build git repository ".git" 2024-02-01T13:59:36 [ERROR] crates/fs/src/fs.rs:272: Error { code: -3, klass: 6, message: "could not find repository from '/Users/kamstut/Dropbox/projects/containers/.git'" } 2024-02-01T14:01:33 [ERROR] { "thread": "main", "payload": "called Option::unwrap() on a None value", "location_data": { "file": "crates/project/src/worktree.rs", "line": 973 }, "backtrace": [ "::create", "::new", "Zed::init_panic_hook::{closure#0}", "std::panicking::rust_panic_with_hook", "std::panicking::begin_panic_handler::{{closure}}", "std::sys_common::backtrace::rust_end_short_backtrace", "_rust_begin_unwind", "core::panicking::panic_fmt", "core::panicking::panic", "::load::{closure#0}::{closure#0}", "<async_task::raw::RawTask<<asynctask::runnable::Builder<>>::spawn_local::Checked<core::pin::Pin<alloc::boxed::Box<dyn core::future::future::Future<Output = core::result::Result<(project::worktree::File, alloc::string::String, core::option::Option), anyhow::Error>>>>>, core::result::Result<(project::worktree::File, alloc::string::String, core::option::Option), anyhow::Error>, ::spawn::inner<core::result::Result<(project::worktree::File, alloc::string::String, core::option::Option), anyhow::Error>>::{closure#0}, ()>>::run", "::run", "Zed::main", "std::sys_common::backtrace::rust_begin_short_backtrace::<fn(), ()>", "std::rt::lang_start::<()>::{closure#0}", "std::rt::lang_start_internal", "std::rt::lang_start::<()>", "_main" ], "app_version": "0.120.5", "release_channel": "Zed", "os_name": "macOS", "os_version": "14.3.0", "architecture": "aarch64", "panicked_on": 1706796093721, "installation_id": "3ae478dd-bd1c-4cca-8f56-92e113f13f3a", "session_id": "49d7e752-79b5-4ad4-a33e-226853c0b96a" }

cross19xx commented 9 months ago

From what I gather from the error log, it mentions the repo is not found:

2024-02-01T13:59:36 [ERROR] crates/fs/src/fs.rs:272: Error { code: -3, klass: 6, message: "could not find repository from '/Users/kamstut/Dropbox/projects/containers/.git'" }
2024-02-01T13:59:36 [INFO] build git repository ".git"
2024-02-01T13:59:36 [ERROR] crates/fs/src/fs.rs:272: Error { code: -3, klass: 6, message: "could not find repository from '/Users/kamstut/Dropbox/projects/containers/.git'" }

I also noticed that you are in the Dropbox folder. could it be that the file has been moved online and you may need to download it before proceeding?

kevinamstutz commented 9 months ago

Absolutely -- those are both distinct possibilities, however, they are causing zed to crash, so I figured the best decision was to report it, especially since it is replicable.

ConradIrwin commented 9 months ago

Thanks for filing this! I saw the crash come through in our logs and was struggling to reproduce.

Will look into fixing!

kevinamstutz commented 9 months ago

Very welcome! Let me know if anything else from my end would be helpful.

ConradIrwin commented 9 months ago

I am still unable to reproduce this on my end.

I am:

I do see a bunch of errors in the logs, but no crashes :/

Do you have any config enabled that might make a difference? What language is your project in?

ConradIrwin commented 9 months ago

The good news is that #6693 almost certainly fixes the crash (though I was testing on an older version :D). The bad news is that we don't really understand the problem yet.

I'm going to fast-track that to stable later today.