You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something curious is that /Users/USERNAME/Library/Application Support/Zed/languages/rust-analyzer/rust-analyzer-2025-02-03 still runs after the lsp crashes, and this is not the rust analyzer that is run in zed. although i dont know a lot about how zed handles LSPs under the hood.
I also tried running vscode, which works without issue.
OS
I am running the latest version of MacOS, which i just upgraded today, which might or might not have something to do with my issue.
I also run nix-darwin through which I installed rustup and my rust toolchain is fully managed by rustup, but i doubt that has too much to do with the issue.
Some more things i tried
Restarting the language server
Since there is a Permission denied (os error 13) at the bottom of the lsp server logs i gave zed full disk access under Settings -> security and privacy -> Full Disk Access
LSP debug log
LSP logs
```
stderr: 2025-02-04T16:55:22.842424+01:00 ERROR failed fetching toolchain version for ManifestPath { file: AbsPathBuf("/Users/USERNAME/code/project/Cargo.toml") } workspace e=Failed to query rust toolchain version via `cd "/Users/USERNAME/code/project" && "/run/current-system/sw/bin/cargo" "--version"`, is your toolchain setup correctly?
stderr: 2025-02-04T16:55:22.915355+01:00 ERROR failed fetching data layout for ManifestPath { file: AbsPathBuf("/Users/USERNAME/code/project/Cargo.toml") } workspace e=unable to fetch target-data-layout via `cd "/Users/USERNAME/code/project" && RUSTC_BOOTSTRAP="1" "/run/current-system/sw/bin/rustc" "-Z" "unstable-options" "--print" "target-spec-json"`
stderr: 2025-02-04T16:55:23.025305+01:00 ERROR FetchWorkspaceError: rust-analyzer failed to load workspace: Failed to load the project at /Users/USERNAME/code/project/Cargo.toml: Failed to read Cargo metadata from Cargo.toml file /Users/USERNAME/code/project/Cargo.toml, None: Failed to run `cd "/Users/USERNAME/code/project" && "/run/current-system/sw/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/Users/USERNAME/code/project/Cargo.toml"`: `cargo metadata` exited with an error: error: could not create home directory: '/Users/USERNAME
stderr: �[?2004l/.rustup': Permission denied (os error 13)
stderr:
stderr:
```
The text was updated successfully, but these errors were encountered:
oneElectron
changed the title
Rust-Analyzer broke after an update
Rust-Analyzer: failed to load workspaces after update
Feb 4, 2025
oneElectron
changed the title
Rust-Analyzer: failed to load workspaces after update
Rust-Analyzer: failed to load workspaces after MacOS update
Feb 4, 2025
workspace e=Failed to query rust toolchain version via cd "/Users/USERNAME/code/project" && "/run/current-system/sw/bin/cargo" "--version", is your toolchain setup correctly?
cargo metadata exited with an error: error: could not create home directory: '/Users/USERNAME stderr: �[?2004l/.rustup': Permission denied (os error 13)
those things are done by rust-analyzer:
it tries to find the rust-related things (which it failed, for some reason)
it tries to invoke cargo metadata on your project (which it failed for another reason)
Zed has nothing to do with this, r-a a separate process and we have no influence over its permissions.
Not sure what can be done here, but trying to run these commands locally, possibly updating your toolchain seems like a good thing to try.
Summary
Rust-analyzer shows the error: "Failed to load workspaces." after starting.
I don't know if my system has some weirdness but here are the steps for me:
Steps to trigger the problem:
Actual Behavior:
rust-analyzer crashes.
Expected Behavior:
rust-analyzer should work.
Some more info
Below I have the lsp debug log. I tried running the commands that log said rust-analyzer failed on, but they seem to work.
cd "/Users/USERNAME/code/project" && /run/current-system/sw/bin/cargo --version
outputscargo 1.84.1 (66221abde 2024-11-19)
as expected.cd "/Users/USERNAME/code/project" && RUSTC_BOOTSTRAP="1" /run/current-system/sw/bin/rustc -Z unstable-options "--print" "target-spec-json"
outputsprint target spec output
{"abi-return-struct-as-int": true,
"arch": "aarch64",
"archive-format": "darwin",
"cpu": "apple-m1",
"crt-objects-fallback": "false",
"data-layout": "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32",
"debuginfo-kind": "dwarf-dsym",
"dll-suffix": ".dylib",
"dynamic-linking": true,
"eh-frame-header": false,
"emit-debug-gdb-scripts": false,
"frame-pointer": "non-leaf",
"function-sections": false,
"has-rpath": true,
"has-thread-local": true,
"is-like-osx": true,
"link-env": [
"ZERO_AR_DATE=1"
],
"link-env-remove": [
"IPHONEOS_DEPLOYMENT_TARGET",
"TVOS_DEPLOYMENT_TARGET",
"XROS_DEPLOYMENT_TARGET"
],
"linker-flavor": "darwin-cc",
"linker-is-gnu": false,
"lld-flavor": "darwin",
"llvm-target": "arm64-apple-macosx",
"max-atomic-width": 128,
"metadata": {
"description": "ARM64 Apple macOS (11.0+, Big Sur+)",
"host_tools": true,
"std": true,
"tier": 1
},
"os": "macos",
"split-debuginfo": "packed",
"stack-probes": {
"kind": "inline"
},
"supported-sanitizers": [
"address",
"thread",
"cfi"
],
"supported-split-debuginfo": [
"packed",
"unpacked",
"off"
],
"target-family": [
"unix"
],
"target-mcount": "\u0001mcount",
"target-pointer-width": "64",
"vendor": "apple"
}
Something curious is that
/Users/USERNAME/Library/Application Support/Zed/languages/rust-analyzer/rust-analyzer-2025-02-03
still runs after the lsp crashes, and this is not the rust analyzer that is run in zed. although i dont know a lot about how zed handles LSPs under the hood.I also tried running vscode, which works without issue.
OS
I am running the latest version of MacOS, which i just upgraded today, which might or might not have something to do with my issue.
I also run nix-darwin through which I installed rustup and my rust toolchain is fully managed by rustup, but i doubt that has too much to do with the issue.
Some more things i tried
Permission denied (os error 13)
at the bottom of the lsp server logs i gave zed full disk access under Settings -> security and privacy -> Full Disk AccessLSP debug log
LSP logs
``` stderr: 2025-02-04T16:55:22.842424+01:00 ERROR failed fetching toolchain version for ManifestPath { file: AbsPathBuf("/Users/USERNAME/code/project/Cargo.toml") } workspace e=Failed to query rust toolchain version via `cd "/Users/USERNAME/code/project" && "/run/current-system/sw/bin/cargo" "--version"`, is your toolchain setup correctly? stderr: 2025-02-04T16:55:22.915355+01:00 ERROR failed fetching data layout for ManifestPath { file: AbsPathBuf("/Users/USERNAME/code/project/Cargo.toml") } workspace e=unable to fetch target-data-layout via `cd "/Users/USERNAME/code/project" && RUSTC_BOOTSTRAP="1" "/run/current-system/sw/bin/rustc" "-Z" "unstable-options" "--print" "target-spec-json"` stderr: 2025-02-04T16:55:23.025305+01:00 ERROR FetchWorkspaceError: rust-analyzer failed to load workspace: Failed to load the project at /Users/USERNAME/code/project/Cargo.toml: Failed to read Cargo metadata from Cargo.toml file /Users/USERNAME/code/project/Cargo.toml, None: Failed to run `cd "/Users/USERNAME/code/project" && "/run/current-system/sw/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/Users/USERNAME/code/project/Cargo.toml"`: `cargo metadata` exited with an error: error: could not create home directory: '/Users/USERNAME stderr: �[?2004l/.rustup': Permission denied (os error 13) stderr: stderr: ```Zed Version and System Specs
Zed: v0.171.6 (Zed)
OS: macOS 15.3.0
Memory: 16 GiB
Architecture: aarch64
The text was updated successfully, but these errors were encountered: