Home / Merged error reference / 82

Texture key already in use / No texture found matching key (texture key lifecycle)

Covers IDs: P02, P03 · Engine: Phaser

P02 · Phaser

'Texture key already in use: ' + key
Verification
源码原文(src/textures/TextureManager.js:273)
Frequency
SO score=1(另 1 帖 score=0)

Trigger: The same key is reused to call this.load.image/atlas/spritesheet in the preload of two scenes that run simultaneously or are re-entered, or after a page refresh the asset cache is not cleared and the same key is loaded again.

Typical cause: TextureManager.checkKey finds the key already exists in the texture list, refuses to silently overwrite the existing texture, returns false and logs the error.

Step-by-step fix:
  1. Load assets shared across scenes only once in the global preload.
  2. Before loading, check this.textures.exists(key); if a reload is truly needed, call this.textures.remove(key) first.
  3. Avoid registering the same asset key repeatedly across multiple scenes with active:true.

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

P03 · Phaser

'No texture found matching key: ' + key
Verification
源码原文(src/textures/TextureManager.js:311)
Frequency
SO score=0

Trigger: Calling this.textures.remove(key) to remove a texture key that has not been registered, was already removed, or whose spelling/casing does not match.

Typical cause: remove first checks exists(key); when the key is not found in the list it only warns and returns directly, without running the destruction flow.

Step-by-step fix:
  1. Check this.textures.exists(key) before removing.
  2. Verify the key spelling and casing match exactly the key registered in preload.
  3. Make sure the texture has finished loading before removing it.

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

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