Skip to content

GitUI crash in empty repo with no remotes #2868

Description

@Yi2255

Describe the bug
GitUI crashes when opening remote-related UI in an empty repo with no remotes configured.
It panics with an index out-of-bounds error

To Reproduce
Steps to reproduce the behavior:

  1. Create a clean repo:
    mkdir -p /i4/gitui_crash0
    cd /i4/gitui_crash0
    git init
  2. Start GitUI:
    gitui
  3. Press keys:
    b

    u
  4. See panic/error.
    `panicked at /i4/gitui/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/gitui-0.28.0/src/popups/remotelist.rs:460:30:
    index out of bounds: the len is 0 but the index is 0

trace:
0: gitui::set_panic_handler::{{closure}}
1: std::panicking::panic_with_hook
2: std::panicking::panic_handler::{{closure}}
3: std::sys::backtrace::__rust_end_short_backtrace
4: __rustc::rust_begin_unwind
5: core::panicking::panic_fmt
6: core::panicking::panic_bounds_check
7: <alloc::vec::Vec<T,A> as core::ops::index::Index>::index
8: <gitui::popups::remotelist::RemoteListPopup as gitui::components::Component>::event
9: gitui::components::event_pump
10: gitui::run_app
11: gitui::main
12: std::sys::backtrace::__rust_begin_short_backtrace
13: main
14: __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
15: __libc_start_main_impl
at ./csu/../csu/libc-start.c:360:3
16: _start`

Expected behavior
GitUI should not panic when no remotes exist.
It should show an empty/disabled state or a user-facing validation message.

Context (please complete the following information):

  • OS/Distro + Version: Ubuntu 24.04.3 LTS
  • GitUI Version [e.g. 0.5]: gitui nightly 2026-02-27 ()
  • Rust version: N/A (prebuilt binary)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions