{"record":{"id":"2fab290e313ada47","repo":"bevyengine/bevy","slug":"unsupported-buffer-format","errorCode":null,"errorMessage":"unsupported buffer format","messagePattern":"unsupported buffer format","errorType":"exception","errorClass":"GltfError","httpStatus":null,"severity":"error","filePath":"crates/bevy_gltf/src/loader/mod.rs","lineNumber":102,"sourceCode":"#[derive(Error, Debug)]\npub enum GltfError {\n    /// Unsupported primitive mode.\n    #[error(\"unsupported primitive mode\")]\n    UnsupportedPrimitive {\n        /// The primitive mode.\n        mode: Mode,\n    },\n    /// Invalid glTF file.\n    #[error(\"invalid glTF file: {0}\")]\n    Gltf(#[from] gltf::Error),\n    /// Binary blob is missing.\n    #[error(\"binary blob is missing\")]\n    MissingBlob,\n    /// Decoding the base64 mesh data failed.\n    #[error(\"failed to decode base64 mesh data\")]\n    Base64Decode(#[from] base64::DecodeError),\n    /// Unsupported buffer format.\n    #[error(\"unsupported buffer format\")]\n    BufferFormatUnsupported,\n    /// The buffer URI was unable to be resolved with respect to the asset path.\n    #[error(\"invalid buffer uri: {0}. asset path error={1}\")]\n    InvalidBufferUri(String, ParseAssetPathError),\n    /// Invalid image mime type.\n    #[error(\"invalid image mime type: {0}\")]\n    #[from(ignore)]\n    InvalidImageMimeType(String),\n    /// Error when loading a texture. Might be due to a disabled image file format feature.\n    #[error(\"You may need to add the feature for the file format: {0}\")]\n    ImageError(#[from] TextureError),\n    /// The image URI was unable to be resolved with respect to the asset path.\n    #[error(\"invalid image uri: {0}. asset path error={1}\")]\n    InvalidImageUri(String, ParseAssetPathError),\n    /// Failed to read bytes from an asset path.\n    #[error(\"failed to read bytes from an asset path: {0}\")]\n    ReadAssetBytesError(#[from] ReadAssetBytesError),\n    /// Failed to load asset from an asset path.","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_gltf/src/loader/mod.rs#L84-L120","documentation":"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.","triggerScenarios":"\"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.","commonSituations":"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.","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."],"exampleFix":"// (before)\n\"buffers\": [{ \"uri\": \"data:text/plain;base64,AAAA\" }]\n// (after)\n\"buffers\": [{ \"uri\": \"data:application/octet-stream;base64,AAAA\" }]","handlingStrategy":"validation","validationCode":"fn buffer_mime_ok(uri: &str) -> bool {\n    uri.starts_with(\"data:application/octet-stream\")\n        || uri.starts_with(\"data:application/gltf-buffer\")\n        || !uri.starts_with(\"data:\")\n}","typeGuard":"fn is_supported_buffer_mime(mime: &str) -> bool {\n    matches!(mime, \"application/octet-stream\" | \"application/gltf-buffer\")\n}","tryCatchPattern":"match err {\n    GltfError::BufferFormatUnsupported => {\n        error!(\"buffer data URI must use application/octet-stream or application/gltf-buffer\");\n    }\n    other => return Err(other.into()),\n}","preventionTips":["Normalize buffer data-URI mimes at export time.","Prefer external .bin or GLB over embedded buffers.","Lint glTF JSON for non-whitelisted buffer mimes."],"tags":["gltf","mime-type","buffer","data-uri","bevy"],"backgroundTag":"unsupported-mime-type","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}