rust-lang / rust-lang/rust-analyzer
thread 'LspServer' panicked at crates\base-db\src\lib.rs:133:14:
Open
Nobody has claimed this yet.
C-bug
I-panic
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Happened when switching revisions where one of the files I had open no longer exists
thread 'LspServer' panicked at crates\base-db\src\lib.rs:133:14:
Unable to fetch FileSourceRootInput; this is a bug
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library\std\src\panicking.rs:692
1: core::panicking::panic_fmt
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library\core\src\panicking.rs:75
2: core::panicking::panic_display
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library\core\src\panicking.rs:261
3: core::option::expect_failed
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library\core\src\option.rs:2024
4: <ide_db::RootDatabase as base_db::SourceDatabase>::file_source_root
5: base_db::change::FileChange::apply
6: hir_expand::change::ChangeWithProcMacros::apply
7: ide_db::apply_change::<impl ide_db::RootDatabase>::apply_change
8: rust_analyzer::global_state::GlobalState::new
9: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
10: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
11: rust_analyzer::main_loop::main_loop
12: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at crates/base-db/src/lib.rs:133:14 and trace the FileChange::apply path shown in the backtrace. Reproduce the problem by switching revisions while an open file no longer exists, then follow how file_source_root is fetched. Done means this scenario no longer causes the LspServer to panic.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100