rust-analyzer: FetchWorkspaceError
[ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: cd "/foo/scratch" && "cargo" "--version" failed: No such file or directory (os error 2)
I have a workspace that has a bunch of crates in it now and for some reason it fails on this particular one. If I cd into each separate crate in the workspace and call vscode on that then rust-analyzer works fine. It seems that running it from the root of the workspace is causing issues.
rust-analyzer version: 0.3.1459-standalone
rustc version: rustc 1.70.0-nightly (2036fdd24 2023-03-27)
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
cargo 1.70.0-nightly (145219a9f 2023-03-27)
rustc 1.70.0-nightly (2036fdd24 2023-03-27)
vscode 1.77.0
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 9
- Comments: 15 (3 by maintainers)
@MaxGraey There is a bug where when you click the
Nooption for the project linking popup it will add the entry, check your workspace’ssettings.jsonand remove thelinkedProjectssettingremoving
linkedProjectsfromsettings.jsonfixed it for me.I’d just like to point out that if anyone else is struggling to find the culprit behind this error, it may be located either of the settings.json files (workspace, default, remote, user).
I found mine in my user settings:
@Veykril Thanks! I thought I had removed any references to
linkedProjectsthat might have accidentally appeared insettings.json. It turned out that this entry was in the workspace section, not globally. So there really was/Cargo.toml. Now everything worksthat’s the answer for me
I found this in one of my
*.code-workspacefiles and not in thesettings.json.This one works for me. Thanks a lot.
This seemed to help but only after I restarted vscode. Unfortunately one of my repositories still can’t get it working. Same error message.