BabylonJS/Babylon.js · error
FrameGraphGenerateMipMapsTask ${this.name}: targetTexture mu
Error message
FrameGraphGenerateMipMapsTask ${this.name}: targetTexture must have createMipMaps set to true What it means
After resolving the target texture, FrameGraphGenerateMipMapsTask.record() checks the texture description's options.createMipMaps flag. Generating mipmaps on a texture that was not allocated with mip levels is invalid, so the task throws. The texture must be created with createMipMaps: true so its mip chain exists.
Source
Thrown at packages/dev/core/src/FrameGraph/Tasks/Texture/generateMipMapsTask.ts:43
this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();
}
public override getClassName(): string {
return "FrameGraphGenerateMipMapsTask";
}
public record() {
if (this.targetTexture === undefined) {
throw new Error(`FrameGraphGenerateMipMapsTask ${this.name}: targetTexture is required`);
}
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);
const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);
if (!outputTextureDescription.options.createMipMaps) {
throw new Error(`FrameGraphGenerateMipMapsTask ${this.name}: targetTexture must have createMipMaps set to true`);
}
const pass = this._frameGraph.addRenderPass(this.name);
pass.setRenderTarget(this.outputTexture);
pass.setExecuteFunc((context) => {
context.generateMipMaps();
});
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
passDisabled.setRenderTarget(this.outputTexture);
passDisabled.setExecuteFunc((_context) => {});
}
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Recreate the target texture with options.createMipMaps: true in frameGraph.createTexture.
- Point targetTexture at a texture that was allocated with mipmaps.
- Remove the mipmap generation task if the texture should stay single-resolution.
Example fix
// before
const tex = fg.createTexture({ name: 'tex', options: { size: { width: 512, height: 512 } } });
// after
const tex = fg.createTexture({ name: 'tex', options: { size: { width: 512, height: 512 }, createMipMaps: true } }); Defensive patterns
Strategy: validation
Validate before calling
const desc = frameGraph.textureManager.getTextureDescription(mipTask.targetTexture);
if (!desc.options.createMipMaps) {
throw new Error('mipmap target must be created with createMipMaps: true');
} Prevention
- Always pass createMipMaps: true in createTexture options for textures destined for mipmap generation.
- Pair texture creation options with the tasks that consume the texture in one config module.
When it happens
Trigger: Assigning a targetTexture created via frameGraph.createTexture with options.createMipMaps false/undefined (default) and then running the mipmap generation task.
Common situations: Reusing an existing render-target texture (created without mipmaps) as a mipmap generation input; changing texture creation options in one place but not the pipeline that assumes mipmaps; copying texture creation code where createMipMaps was omitted.
Related errors
- FrameGraphClearTextureTask ${this.name}: the depth texture (
- FrameGraphGenerateMipMapsTask ${this.name}: targetTexture is
- At least one mesh is needed to create the nav mesh.
- FrameGraphVolumetricLightingTask "${this.name}": targetTextu
- FrameGraphVolumetricLightingTask "${this.name}": lightingVol
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/a772dbf51a2873e0.
Report an issue: GitHub.