rust-lang / rust-lang/rust-analyzer

FetchWorkspaceError: rust-analyzer failed to load workspace: "cargo" "--version" failed: The directory name is invalid. (os error 267)

Open
#14,649 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Currently when I try to run rust-analyzer in vscode on Windows I always get the error
FetchWorkspaceError: rust-analyzer failed to load workspace: "cargo" "--version" failed: The directory name is invalid. (os error 267)
This happens regardless of which projects are in my vscode workspace. It even happens when the vscode workspace is empty!

I am currently using rust-analyzer nighlty
rust-analyzer version: 0.4.1488-standalone (bc78ebd9d 2023-04-23)

I tried with both stable and nightly rust, in case that made any difference - it does not.
rustc 1.69.0 (84c898d65 2023-04-16)
rustc 1.71.0-nightly (8bdcc62cb 2023-04-20)

I find the error message less than helpful. It would be a really good idea to include which directory name is supposedly invalid.

When I have a valid rust project in my vscode workspace, cargo check runs just fine, so something else must be the true problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files or tests. Reproduce the failure in VS Code on Windows with an empty workspace, then trace the "cargo" "--version" invocation and identify how its working directory is selected. Done means the error reports which directory is invalid while preserving the existing failure behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.