Skip to content
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

thread 'main' panicked at 'Positions [(70, After), (71, Before)] are out of range for changeset len 1!', helix-core/src/transaction.rs:478:9 #9830

Open
quesada opened this issue Mar 7, 2024 · 7 comments
Labels
C-bug Category: This is a bug

Comments

@quesada
Copy link

quesada commented Mar 7, 2024

Summary

Crash while editing

Reproduction Steps

Editing a scratch buffer and pressing esc is the closest I could get to isolate the bug; but this is not deterministic. It happened with 3 vsplits, 2 showing the same file, one with a scratch buffer.

Helix log

~/.cache/helix/helix.log
tail ~/.cache/helix/helix.log
2024-03-07T09:13:53.256 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.256 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.375 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.375 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.511 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.511 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.743 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.743 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:14:32.284 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)
2024-03-07T10:32:27.009 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)
q@sirius ~/S/L/pages> tail -50  ~/.cache/helix/helix.log
2024-03-07T09:13:49.127 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:49 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:49.128 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:49.271 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:49 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:49.271 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:49.439 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:49 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:49.439 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:49.567 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:49 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:49.567 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:49.808 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:49 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:49.808 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:49.984 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:49 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:49.984 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:50.080 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:50 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:50.080 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:51.183 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:51 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:51.183 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:51.310 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:51 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:51.310 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:51.391 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:51 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:51.391 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:51.512 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:51 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:51.512 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:51.984 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:51 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:51.984 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:52.056 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:52 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:52.056 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:52.160 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:52 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:52.160 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:52.336 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:52 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:52.336 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:52.456 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:52 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:52.456 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:52.616 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:52 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:52.616 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:52.736 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:52 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:52.736 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.024 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.025 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.128 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.128 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.256 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.256 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.375 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.375 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.511 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.511 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:13:53.743 helix_lsp::transport [ERROR] ltex err <- "Mar 07, 2024 9:13:53 AM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2024-03-07T09:13:53.743 helix_lsp::transport [ERROR] ltex err <- "WARNING: Skipping text check as LanguageTool has not been initialized\n"
2024-03-07T09:14:32.284 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)
2024-03-07T10:32:27.009 helix_core::syntax [ERROR] TS parser failed, disabling TS for the current buffer: Err(Cancelled)```

</details>


### Platform

Linux

### Terminal Emulator

Kitty

### Installation Method

source

### Helix Version

helix 23.10 (b93fae9c)
@quesada quesada added the C-bug Category: This is a bug label Mar 7, 2024
@pascalkuthe
Copy link
Member

pleas provide a panic backtrace or this is not actionable, this kind of panic message could be caused by ahyting

@kirawi kirawi added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 9, 2024
@NickNick
Copy link

NickNick commented Mar 13, 2024

I got a similar panic, with a (minimal) stacktrace. Hope this helps.

thread 'main' panicked at 'Positions [(150004, After), (150004, After)] are out of range for changeset len 149909!', helix-core/src/transaction.rs:461:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: helix_core::transaction::ChangeSet::update_positions
   3: helix_core::selection::Selection::map_no_normalize
   4: helix_view::view::View::apply
   5: helix_view::document::Document::append_changes_to_history
   6: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
   7: helix_term::compositor::Compositor::handle_event
   8: helix_term::application::Application::run::{{closure}}
   9: tokio::runtime::park::CachedParkThread::block_on
  10: tokio::runtime::runtime::Runtime::block_on
  11: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Version: helix 23.10 (f6021dd)

@trink
Copy link
Contributor

trink commented Mar 14, 2024

Here is one way to reproduce it (current master at commit: 6c4d986).

thread 'main' panicked at 'Positions [(7, Before)] are out of range for changeset len 4!', helix-core/src/transaction.rs:478:9

Test Document

a
b

Steps to Reproduce

  1. <C-w>s # hsplit
  2. ]<space> # add_newline_below
  3. % # select_all
  4. 2G # goto_line
  5. ms/ # surround_add
  6. :rla<ret> # reload_all
  7. % # select_all
  8. J # join_selection

@SecretPocketCat
Copy link

This happened to me without using splits. IIRC it started happening after I updated my normal_mode binding to also add a jumplist entry.

[keys.insert]
C-s = ["normal_mode", ":w", "save_selection"]
esc = ["normal_mode", "save_selection"]

stacktrace:

thread 'main' panicked at 'Positions [(2129, After), (2130, Before)] are out of range for changeset len 2119!', hel
ix-core/src/transaction.rs:478:9
    stack backtrace:
       0: rust_begin_unwind
                 at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
       1: core::panicking::panic_fmt
                 at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
       2: helix_core::transaction::ChangeSet::update_positions
       3: helix_core::selection::Selection::map_no_normalize
       4: helix_view::view::View::apply
       5: helix_view::document::Document::append_changes_to_history
       6: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
       7: helix_term::compositor::Compositor::handle_event
       8: helix_term::application::Application::run::{{closure}}
       9: tokio::runtime::park::CachedParkThread::block_on
      10: tokio::runtime::context::runtime::enter_runtime
      11: tokio::runtime::runtime::Runtime::block_on
      12: hx::main

helix 23.4 6a214af

I'll try to get a minimal repro.

@pascalkuthe pascalkuthe removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 20, 2024
@FreddieGilbraith
Copy link
Contributor

FreddieGilbraith commented Jun 7, 2024

also happens very occasionally to me on helix 24.3 (2cadec0), I can't find a common cause, and can't post the file I was working on at the time, unfortunatly. I've added RUST_BACKTRACE=full to my env, so hopefully I can post more details if it happens again

@Antonio-Bennett
Copy link

This happens to me when hitting tab for completion :(

@FreddieGilbraith
Copy link
Contributor

FreddieGilbraith commented Aug 15, 2024

Got this dump on helix 24.3 (9b5f035)

thread 'main' panicked at helix-core/src/transaction.rs:483:9:
Positions [(13389, After), (13390, Before)] are out of range for changeset len 13351!
stack backtrace:
   0:        0x101b1fdc8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4bff038afc05d0ab
   1:        0x100f874b4 - core::fmt::write::he9fa43146d420946
   2:        0x101b1bcb0 - std::io::Write::write_fmt::hf4fd30c8192b15d9
   3:        0x101b1fc08 - std::sys_common::backtrace::print::h5d71f7b09493fc9b
   4:        0x101b217d8 - std::panicking::default_hook::{{closure}}::hb75620628e95e648
   5:        0x101b2151c - std::panicking::default_hook::h4ac4acc64d21c4ad
   6:        0x101b21dcc - std::panicking::rust_panic_with_hook::h81dc715fa5de32cf
   7:        0x101b21ba4 - std::panicking::begin_panic_handler::{{closure}}::h26c73eb75670321f
   8:        0x101b2021c - std::sys_common::backtrace::__rust_end_short_backtrace::hef4773cf0f80485b
   9:        0x101b21958 - _rust_begin_unwind
  10:        0x101be42c8 - core::panicking::panic_fmt::h10bd3bfe5bb30d67
  11:        0x10119fbe0 - helix_core::transaction::ChangeSet::update_positions::hfe0e312b144cfed0
  12:        0x101183aac - helix_core::selection::Selection::map_no_normalize::h578b63e003f294ae
  13:        0x10181a560 - helix_view::view::View::apply::h7828266dccd9dd11
  14:        0x10181a80c - helix_view::view::View::sync_changes::h8b7699c526fc1e13
  15:        0x10187430c - helix_view::editor::Editor::focus::hcb43ab9582620cc2
  16:        0x10164d6fc - helix_term::ui::editor::EditorView::handle_keymap_event::{{closure}}::h0fcd4fa6d7dffaa3
  17:        0x10164d630 - helix_term::ui::editor::EditorView::handle_keymap_event::h134251f43d8fdd0e
  18:        0x10164f650 - <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event::h5510727e96a1cf77
  19:        0x1016463ac - helix_term::compositor::Compositor::handle_event::h0773ed390cafb9b4
  20:        0x1018daa40 - helix_term::application::Application::run::{{closure}}::h81fd53af7884a18d
  21:        0x1018ecb58 - tokio::runtime::park::CachedParkThread::block_on::h042c82d6196ad477
  22:        0x10192f800 - tokio::runtime::runtime::Runtime::block_on::h6b5f5e91b770ca56
  23:        0x10196231c - hx::main::h695dbbc22a14bef6
  24:        0x10196ac6c - std::sys_common::backtrace::__rust_begin_short_backtrace::h7f34373321b84350
  25:        0x101945670 - std::rt::lang_start::{{closure}}::he6217f50c5abdc7c
  26:        0x101b15510 - std::rt::lang_start_internal::haeade8bb0e866fa6
  27:        0x101962418 - _main

I had just pressed the l key and had this file open: https://gist.github.com/FreddieGilbraith/030f2a89e7d93daa2804da6d0475860c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

8 participants