Home / Merged error reference / 78

Index p_frame / p_coord.y is out of bounds (sprite grid frame index)

Covers IDs: G04, G07 · Engine: Godot

G04 · Godot

Index p_frame = %d is out of bounds (vframes * hframes = %d).
Verification
原文命中(抓取页面)
Frequency
论坛回复=1(topic 76993 正文命中)

Trigger: Godot 4.x runtime: Sprite2D.set_frame(n) receives a frame number greater than or equal to vframes*hframes; common after switching texture or sprite sheet without syncing hframes/vframes, or when animation frame data still holds the old sheet's frame count.

Typical cause: Sprite2D::set_frame validates the index with ERR_FAIL_INDEX(p_frame, vframes * hframes); on out-of-bounds, _err_print_index_error assembles this default index message.

Step-by-step fix:
  1. Update hframes and vframes together when switching textures.
  2. Keep frame below vframes*hframes-1.
  3. Clear stale old-frame keyframes in the AnimationPlayer or script.
  4. Reset frame to 0 if needed.

Per-entry sources and capture date are listed at /sources#G04.

G07 · Godot

Index p_coord.y = %d is out of bounds (vframes = %d).
Verification
原文命中(抓取页面)
Frequency
论坛回复=0(topic 74552 正文命中)

Trigger: Godot 4.x runtime: the y coordinate passed to Sprite2D.set_frame_coords(Vector2i(x, y)) exceeds vframes (the p_coord.x / hframes version prints when x exceeds hframes); common when switching between two sprite sheets with different row/column counts.

Typical cause: Sprite2D::set_frame_coords runs ERR_FAIL_INDEX checks on p_coord.x and p_coord.y separately; on out-of-bounds it prints the default index message.

Step-by-step fix:
  1. Update hframes and vframes together when switching sprite sheets.
  2. Keep different state sheets on the same grid row/column count.
  3. Avoid AnimationPlayer keyframes referencing coordinates that do not exist in the current grid.

Per-entry sources and capture date are listed at /sources#G07.

Related errors

Need an offline quick-reference checklist?

Atlas error library Pro pack: 123 error references (110 single + 13 merged) plus a quick-fix guide, $19 one-time purchase, delivered as electronic files.

View Pro pack / order