DEV Community

Yiren Labs
Yiren Labs

Posted on Originally published at yirenlabs.itch.io

Why Phaser says "Invalid Texture Atlas JSON Hash given, missing 'frames' Object"

Invalid Texture Atlas JSON Hash given, missing 'frames' Object

That is the whole message, and it is unusually literal. Phaser's JSON Hash parser looks for one thing before it does anything else: a top-level frames key. If it is not there, parsing stops. Nothing is guessed, nothing is recovered.

When it shows up

  • You exported the atlas in array format but load it with this.load.atlas(), which expects the hash shape. Same art, different container, immediate rejection.
  • The JSON was modified on the way to the browser — minified by a build step that dropped a branch, trimmed by a copy-paste, or served with a truncated tail.
  • The file is a valid object but describes something else entirely, so it simply has no frames member.

The consequence is easy to misread. Parsing aborts, the texture keeps only its __BASE frame, and every later lookup by frame name returns nothing without throwing again. So you end up with a texture that exists, a scene that runs, and no sprites — which is why people search for "sprites disappeared" instead of searching for this message.

What the two shapes actually contain

In hash format the value of frames is an object keyed by frame name, and each value carries the rectangle (x, y, w, h) plus the trim and source-size fields. In array format the same information sits in a list, and each element names its own file, so the array also needs a textures list to say which image the rectangles belong to. That structural difference is the whole reason two loaders exist. When you point the hash parser at an array file, it does not read the list and adapt; it checks for the key, finds a different type or nothing, and stops. Knowing which shape you have takes about four seconds once you know what to look for, and it removes the most common cause of this error from your list.

30-second check

  1. Open the JSON and read the first character after the opening brace. Hash format begins "frames": { and every entry is keyed by frame name. Array format begins "frames": [ — a list, and it normally carries a textures array too.
  2. Match that shape to the loader call. load.atlas expects the hash shape. The multi-atlas loader expects the array shape with its texture list. A mismatch here is the single most common cause.
  3. If the shape looks right, validate the file as JSON. One stray comma, one smart quote, or a missing closing brace produces exactly this "missing frames" verdict, and it is invisible if you only skim the file.

Or paste it and let the checker read it

The free checker in the browser reports the format it detected, how many frames it found, and the faults it can actually prove from the file — missing frames, duplicate frame names, zero-size rects, rects that fall outside the image. No upload, no account, nothing leaves the page: open the checker. Paste the JSON, add the PNG it points at, and you have a verdict in about 60 seconds. If the top level has no frames object at all, that is the first line of the report.

What the checker will not tell you

It reads the file, not your loader call. It can confirm the JSON is hash-shaped and complete; it cannot see that a different part of your code passed it to the multi-atlas loader. Treat the checker as the fast way to rule the file in or out, then check the call site yourself — it is one line, and it is where the mistake usually lives.

If you want the full fix list

The checker names the fault; the playbook gives you the path out of it. The 110-error pack is the written side of this library: symptom, typical log line, root cause, numbered fix steps and prevention for each case, plus a searchable CSV index and a self-test kit with expected verdicts so you can confirm the tool before you trust it on a real project. It is $19, one time, and the free pages stay free.

Top comments (1)

Collapse
 
foundrybell profile image
Foundry Bell •

scene runs