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

**URL:** <https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188>\
**Category:** Tooling and IDE\
**Created:** [December 25, 2022, 7:21pm UTC](https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188 "2022-12-25T19:21:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/fuel/32/1677_2.png) [@fuel](https://forum.fuel.network/u/fuel)\
**Post date:** [December 25, 2022, 7:21pm UTC](https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188/1 "2022-12-25T19:21:49Z")

</div>

Sometimes sway extension doesn’t work

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

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

```

One of errors:

```auto
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/github.com-1ecc6299db9ec823/ropey-1.5.0/src/rope.rs:345:41

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.

---

<div class="post-metadata">

**Author:** ![mohammadfawaz](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mohammadfawaz](https://forum.fuel.network/u/mohammadfawaz)\
**Post date:** [December 27, 2022, 9:09pm UTC](https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188/3 "2022-12-27T21:09:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![fuel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/fuel/32/1677_2.png) [@fuel](https://forum.fuel.network/u/fuel)\
**Post date:** [December 28, 2022, 1:16pm UTC](https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188/4 "2022-12-28T13:16:17Z")

</div>

You can try to autoformat 5 times this file

> <https://github.com/sway-gang/sway-lend/blob/fe2508784f7dc11e6878dfd83136b81cb52e2701/contracts/market/src/main.sw>

You can fork and test this version using these commands

```auto
git clone https://github.com/sway-gang/sway-lend
cd sway lend
git checkout
git checkout fe2508784f7dc11e6878dfd83136b81cb52e2701   
code ./contracts/market/src/main.sw

```

and autoformat 5 times

---

<div class="post-metadata">

**Author:** ![mohammadfawaz](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mohammadfawaz](https://forum.fuel.network/u/mohammadfawaz)\
**Post date:** [January 5, 2023, 4:09pm UTC](https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188/5 "2023-01-05T16:09:11Z")

</div>

> [@fuel](#):
>
> ` Char index out of bounds`

Thank you. I have created a Github issue here: [LSP Crashing with ` Char index out of bounds` · Issue #3699 · FuelLabs/sway · GitHub](https://github.com/FuelLabs/sway/issues/3699). The LSP team should get to it soon.

---

<div class="post-metadata">

**Author:** ![fuel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/fuel/32/1677_2.png) [@fuel](https://forum.fuel.network/u/fuel)\
**Post date:** [January 5, 2023, 7:15pm UTC](https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188/6 "2023-01-05T19:15:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [January 30, 2023, 12:16pm UTC](https://forum.fuel.network/t/the-sway-language-server-server-crashed-5-times-in-the-last-3-minutes/1188/7 "2023-01-30T12:16:38Z")

</div>

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