The Sway Language Server server crashed 5 times in the last 3 minutes

Sometimes sway extension doesn’t work

Smells like this comment crush it inside impl MyContract for Contract {

     * @notice Initialize a new protocol instance
     * @param config The mapping of initial/constant parameters

One of errors:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Char index out of bounds: char index 1951, Rope/RopeSlice char length 1376', /Users/runner/.cargo/registry/src/

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

[Error - 7:18:39 PM] The Sway Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

For more information we can get in touch on discord and I can give more feedback on how the extension works in code.


Hmm I could not reproduce by just adding that comment in the impl block. Do you mind providing a full contract where that issue is reproducible?


You can try to autoformat 5 times this file

You can fork and test this version using these commands

git clone
cd sway lend
git checkout
git checkout fe2508784f7dc11e6878dfd83136b81cb52e2701   
code ./contracts/market/src/main.sw

and autoformat 5 times


Thank you. I have created a Github issue here: LSP Crashing with ` Char index out of bounds` Β· Issue #3699 Β· FuelLabs/sway Β· GitHub. The LSP team should get to it soon.


Thank you too!!! You are doing great things. If there’s anything else I can help with, I’m at your service.


This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.