Invalid Texture Atlas JSON Hash given, missing 'frames' Object
This message comes from the JSON hash parser in src/textures/parsers/JSONHash.js. The whole check is one guard at the top of the parse: if the JSON has no frames object, the parser logs the error and hands the texture back untouched. Nothing throws. The loader still reports progress, the load still completes, and this.textures.exists('hero') returns true. The failure only surfaces later, when something asks for a frame by name.
That "untouched" part is what makes this error confusing. The texture is registered with its image and exactly one frame, __BASE, covering the whole sheet. texture.get('idle_01') finds no match, falls back to the base frame, and your sprite draws the entire sheet squeezed into one cell. Every animation frame points at the same rectangle, so the character looks frozen, flickering, or squashed instead of missing. If you print texture.getFrameNames() you get a one-element array: ["__BASE"].
The shape the parser wants
A hash atlas keeps frames in an object keyed by frame name:
{"frames":{"idle_01":{"frame":{"x":0,"y":0,"w":64,"h":64},"sourceSize":{"w":64,"h":64}},"idle_02":{"frame":{"x":64,"y":0,"w":64,"h":64}}},"meta":{"image":"hero.png","size":{"w":512,"h":512},"scale":"1"}} An array atlas keeps the same data in a list, each entry carrying a filename. Both load through this.load.atlas - an array still has a frames key, so it never trips this guard. That matters for diagnosis: this error does not mean "you exported the wrong of the two formats". It means there is no frames key at all, which is why the message names the hash parser specifically.
Four files that have no top-level frames
A multiatlas export. Multi-atlas JSON looks like {"textures":[{"image":"hero.png","frames":[...]}]}. That is exactly what this.load.multiatlas expects, and exactly what this.load.atlas rejects with this message.
A different tool's schema. Adobe Animate's texture atlas publishes {"ATLAS":{"SPRITES":[...]}}. Spine, Cocos, and several sprite packers put their frame list under other keys. The data is there, just not where Phaser's hash parser looks.
A truncated or substituted file. A CDN returns an HTML error page with a 200 status and a .json URL, a download stops halfway, or the build copies the wrong artifact. Sometimes JSON.parse even succeeds because the file is valid JSON - just not an atlas.
A hand-written atlas. You wrote the meta block to set the image and size, and forgot the frames object, or built the frame list under a different name.
Reproduce it in 60 seconds
Point this.load.atlas at any JSON without a top-level frames object - a multiatlas export is the easiest:
preload() { this.load.atlas('hero', 'assets/hero.png', 'assets/hero-multiatlas.json'); }, create() { console.log(this.textures.get('hero').getFrameNames()); this.add.image(300, 200, 'hero', 'idle_01'); } Two console lines tell the whole story: the Invalid Texture Atlas JSON Hash error, then ["__BASE"]. The image on screen is the full sheet.
Three checks that separate the causes
- Top-level keys.
node -e "const j=require('./hero.json');console.log(Object.keys(j))". Aframeskey means the schema is fine and the problem is elsewhere.texturesmeans multiatlas.ATLASorSPRITESmeans a foreign format. - Frame count and image name. Compare
Object.keys(j.frames).lengthwith the sprite count your packer reported, and check thatj.meta.imagematches the PNG you actually load. A count of zero with aframeskey present is a truncated file. - What the engine kept.
this.textures.get('hero').getFrameNames()increate(). One entry,__BASE, confirms the parser bailed. If you see your frame names here, this error is not yours - look at the texture key instead, because a missing key produces a different message.
Fix
- Multiatlas files go through
this.load.multiatlas('hero', 'hero.json', 'assets/'), and you address frames by the sub-texture key it registers, not by the parent key. If you would rather keep one key, re-export as a single atlas. - Foreign schemas need re-export, not patching. Export JSON (Hash) from your packer, keep the image and JSON as a pair from the same export, and load both in the same
this.load.atlascall. - Truncated files need a size check before the engine sees them. Compare the downloaded JSON with the source artifact, and parse it locally with
JSON.parsefirst - a CDN error page fails in two seconds there instead of silently in the game. - Hand-written atlases need
meta.size. Every frame rectangle must sit inside the image:x + w <= meta.size.wandy + h <= meta.size.h. The parser trusts those numbers and does not clamp them. - Make the next bad export fail loudly. Load the JSON as data alongside the atlas and assert the key before anything uses it:
this.load.json('hero-atlas', 'assets/hero.json'); this.load.once('complete', () => { const j = this.cache.json.get('hero-atlas'); if (!j || !j.frames) throw new Error('atlas JSON has no frames key: ' + JSON.stringify(Object.keys(j || {}))); }); Stop shipping broken atlases
The check that catches this class of bug is mechanical: for every atlas JSON, assert the frames key exists, then assert each rectangle against the PNG dimensions you load next to it. Twenty lines in a build script, or a page you open once per export.
A browser checker that compares an atlas JSON with its PNG - out-of-bounds rectangles, mismatched frame counts, frames that reference a different image - is here: atlas JSON vs PNG checker
For repeated local checks on Windows there is a free offline tool, no email and no account: Atlas Fixer for Windows
The written version - a 50-page playbook plus a CSV index of all 110 collected errors with triggers, causes and fix steps - is here: the $19 Pro pack. Nothing is charged during early access.