DEV Community

Yiren Labs
Yiren Labs

Posted on Originally published at atlas-errors.petersoncool.workers.dev

Phaser: Texture "%s" has no frame "%s" — frame lookup fallback explained

Texture "%s" has no frame "%s"

What the warning looks like

Texture "hero" has no frame "hero_01"
Enter fullscreen mode Exit fullscreen mode

This line appears in the browser console while a sprite, an animation state, or a tile reference asks the texture for a frame name that is not present in its frame dictionary. It is logged as a warning rather than an exception, so the game keeps running even though the requested frame was never resolved. A concrete example: your atlas exports frames padded to two digits, hero_01 through hero_08, but the animation code requests hero_1 with a single digit against a texture built with zeroPad: 2. The lookup misses, and the engine substitutes whatever frame it stored first, leaving you with a silently wrong pose on screen.

Why the lookup falls through

In Phaser 3, Texture#getFrame receives a frame name and looks it up directly on the internal frames dictionary. The relevant branch sits in src/textures/Texture.js, around line 12,265: https://raw.githubusercontent.com/photonstorm/phaser/master/src/textures/Texture.js

When the key is absent, the method does not throw. It writes this warning through the texture logging path, returns the first registered frame, and continues. Because the degradation is silent, the sprite may render the idle pose, the wrong character, or an empty slice of the sheet while the console shows only a yellow warning. The mismatch usually traces to one of three inputs: the name string passed by your own code, the naming metadata baked into the atlas JSON, or a PNG and JSON pair that do not belong to the same export build.

Three-step fix

  1. Print the frame names that actually exist on the texture.
const texture = this.textures.get('hero');
console.log(texture.getFrameNames());
Enter fullscreen mode Exit fullscreen mode

Compare every name in that array with the strings used in your animation config and setFrame calls. Trim stray whitespace, check capitalization, and confirm the digit count matches exactly.

  1. Re-check the atlas JSON naming metadata and digit width.
{
  "frames": {
    "hero_01": { "x": 0, "y": 0, "w": 64, "h": 64 },
    "hero_02": { "x": 64, "y": 0, "w": 64, "h": 64 }
  },
  "meta": {
    "prefix": "",
    "suffix": "",
    "zeroPad": 2
  }
}
Enter fullscreen mode Exit fullscreen mode

If the exporter pads to two digits, every frame reference must carry two digits (hero_01, not hero_1). Adjust prefix, suffix, or the code-side string until both sides agree on the final key.

  1. Verify the JSON and PNG are the same export, then reload the texture cleanly.
this.load.atlas('hero', 'assets/hero.png', 'assets/hero.json');
this.load.once('complete', () => {
  const names = this.textures.get('hero').getFrameNames();
  console.log('loaded frames:', names);
});
this.load.start();
Enter fullscreen mode Exit fullscreen mode

Re-export the atlas from the sprite editor so both files come from the same project version, and drop any cached old copy before issuing the reload.

Quick reference

Symptom Root cause What to check Expected value
Console warns has no frame "hero_1" Code drops a leading zero Compare request string against getFrameNames() Two-digit padded name hero_01
Sprite shows the first idle frame instead of the target pose Lookup missed and fell back to frame 0 Confirm the requested key exists in the JSON Key present under frames
Half the frames are missing after an editor update JSON and PNG came from different exports Re-export atlas together, clear cache One matching JSON/PNG pair
Names carry a prefix the code omits meta.prefix not applied on the lookup side Read meta.prefix and prepend it Full prefixed frame key

Run the free atlas self-check to list missing or mis-padded frame names before you touch the loader: https://atlas-errors.petersoncool.workers.dev/inspector/?ref=dev2_free_1

The complete repair bundle covers frame-name auditing, JSON/PNG version drift, and loader reload patterns for Phaser projects: https://atlas-errors.petersoncool.workers.dev/checkout/?ref=dev2_buy_1

Top comments (0)