bevyengine/bevy · error · GltfError
unsupported buffer format
Error message
unsupported buffer format
What it means
In load_buffers (loader/mod.rs:1937-1941) a buffer supplied as a data URI is accepted only if its MIME type is one of ["application/octet-stream", "application/gltf-buffer"]. Any other MIME (Ok(data_uri) arm falling through to `Ok(_)`) returns BufferFormatUnsupported. The check exists because Bevy only knows how to treat embedded buffer bytes as raw binary.
Source
Thrown at crates/bevy_gltf/src/loader/mod.rs:102
#[derive(Error, Debug)]
pub enum GltfError {
/// Unsupported primitive mode.
#[error("unsupported primitive mode")]
UnsupportedPrimitive {
/// The primitive mode.
mode: Mode,
},
/// Invalid glTF file.
#[error("invalid glTF file: {0}")]
Gltf(#[from] gltf::Error),
/// Binary blob is missing.
#[error("binary blob is missing")]
MissingBlob,
/// Decoding the base64 mesh data failed.
#[error("failed to decode base64 mesh data")]
Base64Decode(#[from] base64::DecodeError),
/// Unsupported buffer format.
#[error("unsupported buffer format")]
BufferFormatUnsupported,
/// The buffer URI was unable to be resolved with respect to the asset path.
#[error("invalid buffer uri: {0}. asset path error={1}")]
InvalidBufferUri(String, ParseAssetPathError),
/// Invalid image mime type.
#[error("invalid image mime type: {0}")]
#[from(ignore)]
InvalidImageMimeType(String),
/// Error when loading a texture. Might be due to a disabled image file format feature.
#[error("You may need to add the feature for the file format: {0}")]
ImageError(#[from] TextureError),
/// The image URI was unable to be resolved with respect to the asset path.
#[error("invalid image uri: {0}. asset path error={1}")]
InvalidImageUri(String, ParseAssetPathError),
/// Failed to read bytes from an asset path.
#[error("failed to read bytes from an asset path: {0}")]
ReadAssetBytesError(#[from] ReadAssetBytesError),
/// Failed to load asset from an asset path.View on GitHub (pinned to 396ca72708)
Solutions
- Set the buffer data-URI MIME to application/octet-stream (or application/gltf-buffer).
- Move the buffer to an external .bin file referenced with a relative uri.
- Switch the whole asset to GLB so buffers live in the BIN chunk.
Example fix
// (before)
"buffers": [{ "uri": "data:text/plain;base64,AAAA" }]
// (after)
"buffers": [{ "uri": "data:application/octet-stream;base64,AAAA" }] Defensive patterns
Strategy: validation
Validate before calling
fn buffer_mime_ok(uri: &str) -> bool {
uri.starts_with("data:application/octet-stream")
|| uri.starts_with("data:application/gltf-buffer")
|| !uri.starts_with("data:")
} Type guard
fn is_supported_buffer_mime(mime: &str) -> bool {
matches!(mime, "application/octet-stream" | "application/gltf-buffer")
} Try / catch
match err {
GltfError::BufferFormatUnsupported => {
error!("buffer data URI must use application/octet-stream or application/gltf-buffer");
}
other => return Err(other.into()),
} Prevention
- Normalize buffer data-URI mimes at export time.
- Prefer external .bin or GLB over embedded buffers.
- Lint glTF JSON for non-whitelisted buffer mimes.
When it happens
Trigger: "uri": "data:text/plain;base64,..." or "data:application/octet-stream,..." variants are fine, but e.g. "data:application/x-custom;base64,..." for a buffer triggers the error; also non-base64 data URIs whose mime is not in the whitelist.
Common situations: Generators that embed buffers with a generic or vendor MIME; hand-authored data URIs; exporters that prefix buffers with the model's own mime type.
Related errors
- failed to decode base64 mesh data
- binary blob is missing
- invalid buffer uri: {0}. asset path error={1}
- invalid image mime type: {0}
- failed to read bytes from an asset path: {0}
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/2fab290e313ada47.
Report an issue: GitHub.