Skip to content

Panic during rename with small vault "to have key" in graph.rs:713 #278

@zipproth

Description

@zipproth

IWE LSP server (iwes) panics during a rename operation right after the first tutorial step.

Steps to reproduce

  1. Follow steps of the IWE tutorial, then add an image (image.png). The resulting vault is shown in the screenshot:
    • test.md containing a link [Another section](nhmwt462) and an image ![alt text](image.png)
    • nhmwt462.md
    • image.png
  2. Open test.md in VS Code (IWE extension v0.0.4).
  3. Place the cursor on the link target nhmwt462 and press F2 → confirm rename.
Image

Actual result

iwes panics; rename fails.

2026-05-05T07:04:04.348750Z  INFO iwes: starting IWE LSP server

thread 'main' (620931) panicked at /home/stefan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/liwe-0.1.2/src/graph.rs:713:57:
to have key
stack backtrace:
   0:     0x5591bcd84d02 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h93773fc827e3113d
   1:     0x5591bcd98c5a - core::fmt::write::hed7b5c73d82ecb7c
   2:     0x5591bcd50a06 - std::io::Write::write_fmt::h6f0185aecf0ed75f
   3:     0x5591bcd62259 - std::panicking::default_hook::{{closure}}::h2be84df4f189ae36
   4:     0x5591bcd620b9 - std::panicking::default_hook::hf0ea8939246f43a9
   5:     0x5591bcd6254b - std::panicking::panic_with_hook::hb4bd9ac1123582a0
   6:     0x5591bcd62318 - std::panicking::panic_handler::{{closure}}::hde00dd15f5637fe2
   7:     0x5591bcd5cbf9 - std::sys::backtrace::__rust_end_short_backtrace::hb72197fa777c1785
   8:     0x5591bcd440dd - __rustc[4425a7e20b4c8619]::rust_begin_unwind
   9:     0x5591bcda2c7c - core::panicking::panic_fmt::ha59b517dd231f4da
  10:     0x5591bcda1d04 - core::option::expect_failed::h4104d968f11511b3
  11:     0x5591bca7a3b8 - <&liwe::graph::Graph as liwe::graph::GraphContext>::collect::hb3cd743f3b8adef6
  12:     0x5591bc933f8f - iwes::router::server::Server::handle_rename::h59bfa58a2f251877
  13:     0x5591bc954a1c - iwes::router::Router::run::h825c8813482f2746
  14:     0x5591bc93943d - iwes::main_loop::h607a84d09e8d3bd1
  15:     0x5591bc8842b9 - iwes::main::h71ac78edf1ce87ef
  16:     0x5591bc890da3 - std::sys::backtrace::__rust_begin_short_backtrace::h1c61a0a2db54bb01
  17:     0x5591bc87ffc9 - std::rt::lang_start::{{closure}}::haac166b4a5052205
  18:     0x5591bcd52536 - std::rt::lang_start_internal::h9f282d832ae47dd5
  19:     0x5591bc886525 - main
  20:     0x7f906e7ba741 - <unknown>
  21:     0x7f906e7ba879 - __libc_start_main
  22:     0x5591bc8272b5 - _start
  23:                0x0 - <unknown>
2026-05-05T07:11:46.189319Z ERROR iwes::router: Panic message: Panic occurred with message: to have key

Expected result

Rename updates the linked file (nhmwt462.md → new name) and all references in test.md without crashing.

Possible cause (speculation)

The panic originates in GraphContext::collect with the message to have key, which looks like a HashMap::get(...).expect("to have key") on a key that isn't registered in the graph. The image link image.png is not a note key but might still be visited while collecting references during the rename operation.

Environment

  • iwe --version: iwe 0.1.2
  • Crate: liwe 0.1.2 (per panic location)
  • VS Code extension: iwe.iwe v0.0.4
  • OS: Arch Linux
  • Vault: 2 .md files + 1 image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions