rust-lang / rust-lang/rust-analyzer

"terminated with exit code 101" and "Failed to discover workspace"

Open
#14,003 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Forum for questions: https://users.rust-lang.org/c/ide/14

No one replies here --- https://users.rust-lang.org/t/error-rust-analyzer-failed-to-discover-workspace/87621/1

rust-analyzer version: rust-analyzer 1.66.1 (90743e7 2023-01-10)
rustc version: rustc 1.66.1 (90743e729 2023-01-10)

I installed rust-analyzer via: rustup component add rust-analyzer. And told my IDE to use this: /home/dimanne/.cargo/bin/rustup run stable rust-analyzer -v --log-file /home/dimanne/ra.txt --no-log-buffering.

But it is not working for me...

Attempt 1: Empty initializationOptions

Here is full debug output: https://gist.github.com/DimanNe/66cbc6c0622e655ba94739ea6e4e10d9

Attempt 2: Set linkedProjects

I tried specifying linkedProjects in initializationOptions:

{
  "linkedProjects": ["/home/dimanne/devel/raspberrypi/thermo_rust/thermo/Cargo.toml"]
}

I got the following output:

LanguageClient Rust: The command "/home/dimanne/.cargo/bin/rustup run stable rust-analyzer -v --log-file /home/dimanne/ra.txt --no-log-buffering" terminated with exit code 101.
LanguageClient Rust: Unexpectedly finished

Here is full debug output: https://gist.github.com/DimanNe/bfeaa04e3de22bdd18ab1683227c418f

It looks like both ends with this:

[DEBUG lsp_server::msg] > {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"end"}}}    
[DEBUG lsp_server::msg] > {"jsonrpc":"2.0","id":3,"method":"workspace/semanticTokens/refresh"}    
[DEBUG rust_analyzer::main_loop] will prime caches cause=became quiescent
[DEBUG lsp_server::msg] < {"id":0,"jsonrpc":"2.0","result":null}    
[DEBUG rust_analyzer::main_loop] Instant { tv_sec: 95926, tv_nsec: 9218448 } handle_event(Response(Response { id: RequestId(I32(0)), result: None, error: None }))
[DEBUG rust_analyzer::main_loop] Instant { tv_sec: 95926, tv_nsec: 9223748 } handle_event(Diagnostics([]))
[DEBUG lsp_server::msg] > {"jsonrpc":"2.0","id":4,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Indexing"}}    
[DEBUG salsa] unwind_if_cancelled: current_revision=R6, pending_revision=R6    
[DEBUG lsp_server::msg] > {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"begin","title":"Indexing","cancellable":false,"percentage":0}}}    
[DEBUG lsp_server::msg] < {"error":{"code":-32601},"id":1,"jsonrpc":"2.0"}

Any suggestions / ideas?

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

Start with the two linked debug logs and the linkedProjects initializationOptions example; no repository file, test, or entry point is named. Reproduce the reported rust-analyzer 1.66.1 startup failure, then identify a maintainer-confirmed fix and regression-test target before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.