bevyengine/bevy · error · TextureReinterpretationError
can not evenly divide height = {height} by layers = {layers}
Error message
can not evenly divide height = {height} by layers = {layers} What it means
Returned by ImageError::HeightNotDivisibleByLayers when converting a stacked sprite sheet into a texture array: the total image height is not an exact multiple of the requested layer count, so the image cannot be split into equal-height layers.
Source
Thrown at crates/bevy_image/src/image.rs:2237
/// The stacked image could not be evenly divided into the desired number of image layers.
#[error("can not evenly divide height = {height} by layers = {layers}")]
HeightNotDivisibleByLayers {
/// The total image height in pixels.
height: u32,
/// The desired number of image layers.
layers: u32,
},
/// The grid height is not divisible by the number of tiles in the height.
#[error("can not evenly divide grid with height = {height} by tiles = {tile_count_y}")]
GridHeightNotDivisibleByTileHeight {
/// The total image height in pixels.
height: u32,
/// The desired number of image layers.
tile_count_y: u32,
},
/// The grid width is not divisible by the number of tiles in the width.
#[error("can not evenly divide grid with width = {width} by tiles = {tile_count_x}")]
GridWidthNotDivisibleByTileWidth {
/// The total image height in pixels.
width: u32,
/// The desired number of image layers.
tile_count_x: u32,
},
/// The texture format is not supported.
#[error("Cannot process texture in its current format. Is it compressed?")]
InvalidTextureFormat,
}
/// An error that occurs when accessing specific pixels in a texture.
#[derive(Error, Debug)]
pub enum TextureAccessError {
/// Attempted to access a pixel outside the texture bounds.
#[error("out of bounds (x: {x}, y: {y}, z: {z})")]
OutOfBounds {
/// The pixel x-coordinate.
x: u32,View on GitHub (pinned to 8d743eb7dc)
Solutions
- Adjust the number of layers so it evenly divides the image height
- Resize or crop the source image so its height is a multiple of the layer count
- Fix the wrong image asset being used for the intended layer count
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_image/src/image.rs:2220 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bevyengine/bevy@8d743eb7dc (2026-08-20).
Data as JSON: /api/errors/58f3b6c7fc1e9cda.
Report an issue: GitHub.