{"record":{"id":"097f7608da713e4b","repo":"phaserjs/phaser","slug":"particle-has-no-texture-frame","errorCode":null,"errorMessage":"Particle has no texture frame","messagePattern":"Particle has no texture frame","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/gameobjects/particles/Particle.js","lineNumber":462,"sourceCode":"    {\n        var emitter = this.emitter;\n        var ops = emitter.ops;\n\n        var anim = emitter.getAnim();\n\n        if (anim)\n        {\n            this.anims.play(anim);\n        }\n        else\n        {\n            this.frame = emitter.getFrame();\n            this.texture = this.frame.texture;\n        }\n\n        if (!this.frame)\n        {\n            throw new Error('Particle has no texture frame');\n        }\n\n        //  Updates particle.x and particle.y during this call\n        emitter.getEmitZone(this);\n\n        if (x === undefined)\n        {\n            this.x += ops.x.onEmit(this, 'x');\n        }\n        else if (ops.x.steps > 0)\n        {\n            //  EmitterOp is stepped but x was forced (follower?) so use it\n            this.x += x + ops.x.onEmit(this, 'x');\n        }\n        else\n        {\n            this.x += x;\n        }","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/phaserjs/phaser/blob/41be1e462bc600064e498cba370bfa8c5c055a22/src/gameobjects/particles/Particle.js#L444-L480","documentation":"Particle.js:462 throws when `this.frame` is falsy after the emit logic. The frame comes from `emitter.getFrame()` (ParticleEmitter.js:1265) which picks from `this.frames`; if that array is empty the returned value is undefined and the guard fires. A particle must have a texture frame to render.","triggerScenarios":"Creating a ParticleEmitter whose texture key does not exist in the TextureManager, or whose texture has no frames; calling `setTexture` with a non-existent key; emitting before the texture finished loading. Also when a custom emit config selects frames from an empty `frames` array.","commonSituations":"Loading a texture with a wrong key, misspelling the texture key in the emitter config, or referencing an atlas frame that doesn't exist. Also calling `emitter.explode()`/`emitParticleAt()` synchronously in `create()` when the asset loader hasn't completed.","solutions":["Ensure the texture key passed to the emitter config exists and has loaded (check `this.textures.exists(key)`).","Load the texture in `preload()` and only create the emitter in `create()` after the loader completes.","If using an atlas, verify the frame name(s) exist via `this.textures.get(key).has(frameName)`.","Provide a `defaultFrame`/valid frames list so `getFrame()` always returns a Frame."],"exampleFix":"// before\nthis.add.particles(0, 0, 'missingKey', { speed: 100 })\n// after\n// in preload()\nthis.load.image('spark', 'assets/spark.png')\n// in create()\nthis.add.particles(0, 0, 'spark', { speed: 100 })","handlingStrategy":"validation","validationCode":"const key = 'spark'\nif (!this.textures.exists(key)) {\n  console.error(`Texture '${key}' not loaded; cannot create emitter`)\n} else {\n  this.add.particles(0, 0, key, { speed: 100 })\n}","typeGuard":"const textureHasFrame = (textures, key, frame) => {\n  if (!textures.exists(key)) return false\n  const tex = textures.get(key)\n  return frame == null || tex.has(frame)\n}","tryCatchPattern":null,"preventionTips":["Load textures in preload() and build emitters in create() after the loader resolves.","Verify texture keys with this.textures.exists(key) before referencing them.","For atlases, check tex.has(frameName) for each frame the emitter config names."],"tags":["particles","texture","assets","runtime"],"backgroundTag":null,"analyzedSha":"41be1e462bc600064e498cba370bfa8c5c055a22","analyzedAt":"2026-08-13T04:23:39.729Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}