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

Error "Index p_idx = -1 is out of bounds (edited_scene.size() = 1)" emitted during opening of a Godot editor #79944

Closed
hvarga opened this issue Jul 27, 2023 · 0 comments · Fixed by #79945

Comments

@hvarga
Copy link
Contributor

hvarga commented Jul 27, 2023

Godot version

4.2.dev [202e4b2]

System information

Godot v4.2.dev (202e4b2) - SteamOS holo - X11 - Vulkan (Forward+) - integrated AMD Custom GPU 0405 (RADV VANGOGH) () - AMD Custom APU 0405 (8 Threads)

Issue description

Opening any project with Godot COULD emit error message Index p_idx = -1 is out of bounds (edited_scene.size() = 1).. This error message will be visible in Godot editor as well as in the terminal (if Godot is opened from terminal).

After some debugging, I have come to following conclusion and found the root cause. Godot editor saves the editor state like the list of all opened scenes and the current edited scene in .godot/editor/editor_layout.cfg (project relative path). The problem is that current edited scene (represented as current_scene in EditorNode section of the configuration file) was not updated when all scenes are closed while the list of all opened scenes is properly updated. This leaves the value for current_scene to the value from the previous Godot editor launch:

[EditorNode]

open_scenes=PackedStringArray()
current_scene="res://scenes/node2.tscn"
center_split_offset=0
selected_default_debugger_tab_idx=0
selected_main_editor_idx=1

Godot editor, when started, will read this configuration file and open all scenes listed in open_scenes and select the scene tab represented by current_scene. Since res://scenes/node2.tscn is not found in the list of opened scenes, the error message is emitted:

ERROR: Index p_idx = -1 is out of bounds (edited_scene.size() = 1).

Issue was introduced in:

commit 454befc880f391448bbd1dce56a38897f5dd3037
Author: Alex Drozd <drozdster@gmail.com>
Date:   Mon Jun 12 20:00:42 2023 +0200

    Prevent non-existent scene from being saved to persistent editor config

It is only reproducible on master branch.

Steps to reproduce

This issue can be reproduced with ANY project by following steps:

  1. Start Godot editor.
  2. Open a scene (any one).
  3. Quit Godot editor.
  4. Start Godot editor.
  5. Close the opened scene. The issue can only be triggered when you closed ALL opened scenes.
  6. Quit Godot editor.
  7. Start Godot editor.

Minimal reproduction project

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants