### Kivy Graphics `IndexError` on Application Startup

18 views
Skip to first unread message

Gorkem Cismel

unread,
Sep 22, 2025, 4:49:57 PM (5 days ago) Sep 22
to Kivy users support
  Hello,


  I'm encountering a crash on startup with the error IndexError: list index out of range originating from
  Kivy's internal graphics engine.

  This error is typically caused by an imbalance in the graphics instruction stack. After reviewing the
  code, the likely cause is redundant loading of .kv files.


  The main slothrunner.kv file uses the #:include directive to manually load the .kv files for each screen
  (e.g., profilescreen.kv, settingsscreen.kv). However, Kivy's engine is designed to automatically find and
  load these files because their names match the corresponding screen class names (e.g., ProfileScreen ->
  profilescreen.kv).


  This double-loading process likely corrupts the graphics state, leading to the crash.

  To fix this, you should remove the following lines from the end of the `C:\Users\cisme\Desktop\Game
  projects\sloth_runner\kv\slothrunner.kv` file:


  `kv
  #:include settingsscreen.kv
  #:include profilescreen.kv
  #:include how_to_play_screen.kv
  `


  Removing these lines will eliminate the redundant loading and should resolve the IndexError.

ElliotG

unread,
Sep 22, 2025, 6:40:23 PM (5 days ago) Sep 22
to Kivy users support
This looks like a response to a previous message - but I can't seem to find the original post.
Kivy does not automatically load screen class kv files.  It will try to load a kv file with the same name as the App class.  
The log will show redundant loads of kv files.

Gorkem Cismel

unread,
Sep 23, 2025, 6:19:09 AM (4 days ago) Sep 23
to Kivy users support
Thank you for your support. The problem seems to be solved for now. I hope I can finish the project without encountering any further issues :)

23 Eylül 2025 Salı tarihinde saat 01:40:23 UTC+3 itibarıyla ElliotG şunları yazdı:
Reply all
Reply to author
Forward
0 new messages