zulip/zulip-terminal

IndexError on starting (focus index vs message id)

Open

#1,226 opened on May 16, 2022

 (8 comments) (0 reactions) (0 assignees)Python (352 forks)github user discovery
bug: crashfurther discussion requiredhelp wanted

Repository metrics

Stars
 (853 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

This was discussed in #zulip-terminal > IndexError while starting., and has been reported by:

  • Aryan Shridhar
  • @Dishti-Oberai
  • @rht

This appears to be distinct from #326.

ZT is reported to crash before the UI loads.

The traceback ends with

IndexError: focus index is out of range: 1330877

(where the last number varies)

The bug currently occurs due to views.py line 119, on the assumption that:

  • the model provides a current focused message id
  • the focused message is set to the id
  • the initializer for MessageView sets the listbox focus to that id...
  • ...which is likely out of range, given ~30 messages in list, and message ids potentially being huge!

A temporary workaround is to remove that statement, but a fuller solution should likely consider how we handle/retain focus between narrows.

Contributor guide