Skip to content

LspServer panicked at 'index out of bounds: the len is 0 but the index is 0' #12879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ralpha opened this issue Jul 26, 2022 · 3 comments · Fixed by #12881
Closed

LspServer panicked at 'index out of bounds: the len is 0 but the index is 0' #12879

ralpha opened this issue Jul 26, 2022 · 3 comments · Fixed by #12881
Assignees

Comments

@ralpha
Copy link

ralpha commented Jul 26, 2022

Just opened a project in VSCode and it showed a message "The Rust Analyzer Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.".

Here is the output:

thread 'LspServer' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/rust-analyzer/src/reload.rs:358:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:84:5
   3: rust_analyzer::reload::<impl rust_analyzer::global_state::GlobalState>::switch_workspaces
   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
   5: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   6: rust_analyzer::main_loop::main_loop
   7: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', lib/lsp-server/src/stdio.rs:29:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 1:58:21 PM] Connection to server got closed. Server will restart.
[Error - 1:58:21 PM] Request textDocument/foldingRange failed.
Error: Connection got disposed.
	at Object.dispose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:29:4495)
	at Object.dispose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:34:10387)
	at _l.handleConnectionClosed (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:36:10613)
	at _l.handleConnectionClosed (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:39:49379)
	at t (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:36:10321)
	at Pa.invoke (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:14370)
	at Br.fire (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:15139)
	at Nt (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:3:6314)
	at Pa.invoke (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:14370)
	at Br.fire (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:15139)
	at xo.fireClose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:17394)
	at Socket.<anonymous> (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:18924)
	at Socket.emit (node:events:402:35)
	at Pipe.<anonymous> (node:net:687:12)
[Error - 1:58:21 PM] Request textDocument/hover failed.
Error: Connection got disposed.
	at Object.dispose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:29:4495)
	at Object.dispose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:34:10387)
	at _l.handleConnectionClosed (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:36:10613)
	at _l.handleConnectionClosed (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:39:49379)
	at t (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:36:10321)
	at Pa.invoke (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:14370)
	at Br.fire (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:15139)
	at Nt (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:3:6314)
	at Pa.invoke (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:14370)
	at Br.fire (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:15139)
	at xo.fireClose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:17394)
	at Socket.<anonymous> (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:18924)
	at Socket.emit (node:events:402:35)
	at Pipe.<anonymous> (node:net:687:12)
[Error - 1:58:21 PM] Request textDocument/codeLens failed.
Error: Connection got disposed.
	at Object.dispose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:29:4495)
	at Object.dispose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:34:10387)
	at _l.handleConnectionClosed (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:36:10613)
	at _l.handleConnectionClosed (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:39:49379)
	at t (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:36:10321)
	at Pa.invoke (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:14370)
	at Br.fire (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:15139)
	at Nt (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:3:6314)
	at Pa.invoke (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:14370)
	at Br.fire (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:15139)
	at xo.fireClose (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:17394)
	at Socket.<anonymous> (/home/user/.vscode/extensions/rust-lang.rust-analyzer-0.4.1141-linux-x64/out/main.js:2:18924)
	at Socket.emit (node:events:402:35)
	at Pipe.<anonymous> (node:net:687:12)
thread 'LspServer' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/rust-analyzer/src/reload.rs:358:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:84:5
   3: rust_analyzer::reload::<impl rust_analyzer::global_state::GlobalState>::switch_workspaces
   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
   5: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   6: rust_analyzer::main_loop::main_loop
   7: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', lib/lsp-server/src/stdio.rs:29:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 1:58:22 PM] Connection to server got closed. Server will restart.
thread 'LspServer' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/rust-analyzer/src/reload.rs:358:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:84:5
   3: rust_analyzer::reload::<impl rust_analyzer::global_state::GlobalState>::switch_workspaces
   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
   5: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   6: rust_analyzer::main_loop::main_loop
   7: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', lib/lsp-server/src/stdio.rs:29:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 1:58:23 PM] Connection to server got closed. Server will restart.
thread 'LspServer' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/rust-analyzer/src/reload.rs:358:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:84:5
   3: rust_analyzer::reload::<impl rust_analyzer::global_state::GlobalState>::switch_workspaces
   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
   5: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   6: rust_analyzer::main_loop::main_loop
   7: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', lib/lsp-server/src/stdio.rs:29:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 1:58:24 PM] Connection to server got closed. Server will restart.
thread 'LspServer' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/rust-analyzer/src/reload.rs:358:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:84:5
   3: rust_analyzer::reload::<impl rust_analyzer::global_state::GlobalState>::switch_workspaces
   4: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
   5: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   6: rust_analyzer::main_loop::main_loop
   7: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', lib/lsp-server/src/stdio.rs:29:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 1:58:25 PM] The Rust Analyzer Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Issue started since today. (was working fine 20 hours ago)
When I reload the same errors come up.
Opening a different project it gives the same result. (crashed with same error)
I switched to release version for now to fix the issue.

I hope this helps with debugging the issue.

rust-analyzer version: rust-analyzer version: 0.4.1141-standalone (0b1ed70 2022-07-25) (Pre-release)

rustc version: rustc 1.61.0 (fe5b13d68 2022-05-18)

relevant settings: NA

@Veykril Veykril self-assigned this Jul 26, 2022
@Veykril
Copy link
Member

Veykril commented Jul 26, 2022

Ye that was an oversight on my part, if proc-macros are disabled we just panic

@ralpha
Copy link
Author

ralpha commented Jul 26, 2022

Ye that was an oversight on my part, if proc-macros are disabled we just panic

Yeah that can be it, still have proc macros disabled because of a previous issue, from quite some time ago. Have never re-enabled it.
But at least we found a bug that way :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants