{"record":{"id":"d2df59440e564e2a","repo":"bevyengine/bevy","slug":"invalid-buffer-uri-0-asset-path-error-1","errorCode":null,"errorMessage":"invalid buffer uri: {0}. asset path error={1}","messagePattern":"invalid buffer uri: (.+?)\\. asset path error=(.+?)","errorType":"exception","errorClass":"GltfError","httpStatus":null,"severity":"error","filePath":"crates/bevy_gltf/src/loader/mod.rs","lineNumber":105,"sourceCode":"    #[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.\n    #[error(\"failed to load asset from an asset path: {0}\")]\n    AssetLoadError(#[from] AssetLoadError),\n    /// Missing sampler for an animation.","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_gltf/src/loader/mod.rs#L87-L123","documentation":"Raised at loader/mod.rs:1944-1947 when a buffer's uri is not a data URI and LoadContext::resolve_embed_str(uri) fails, yielding InvalidBufferUri(uri, ParseAssetPathError). Bevy resolves buffer URIs relative to the glTF asset's own path so the .bin counts as an embedded/child asset; URIs that are absolute (http://, /abs, C:\\) or otherwise cannot live under the parent asset path fail resolution.","triggerScenarios":"\"uri\": \"http://cdn.example.com/scene.bin\"; \"uri\": \"/shared/scene.bin\"; a uri that escapes the asset root; Windows-style backslash separators in the uri.","commonSituations":"Models downloaded with remote references left in; asset folders moved after export so relative structure broke; CI copying only some files.","solutions":["Download the .bin and rewrite the uri to a relative path next to the .gltf (\"scene.bin\").","Keep the exporter's output folder intact: .gltf, .bin and textures must stay siblings.","Use forward slashes; Bevy's asset paths are '/'-separated.","Single-file GLB avoids external references entirely."],"exampleFix":"// (before)\n\"buffers\": [{ \"uri\": \"http://cdn.example.com/scene.bin\" }]\n// (after) file shipped next to the model\n\"buffers\": [{ \"uri\": \"scene.bin\" }]","handlingStrategy":"validation","validationCode":"fn buffer_uris_resolve(model: &std::path::Path, json: &serde_json::Value) -> Vec<String> {\n    json[\"buffers\"].as_array().unwrap_or(&vec![]).iter()\n        .filter_map(|b| b[\"uri\"].as_str())\n        .filter(|u| !u.starts_with(\"data:\"))\n        .filter(|u| u.contains(\"://\") || u.starts_with('/') || std::path::Path::new(u).is_absolute())\n        .map(String::from)\n        .collect() // non-empty => loading will fail with InvalidBufferUri\n}","typeGuard":null,"tryCatchPattern":"match err {\n    GltfError::InvalidBufferUri(uri, e) => {\n        error!(\"buffer uri {uri} cannot resolve under the asset path ({e}); localize the file and use a relative uri\");\n    }\n    other => return Err(other.into()),\n}","preventionTips":["Keep each export's .gltf/.bin/textures in one folder, unmodified.","Rewrite absolute/remote uris to relative ones in an import step.","Prefer GLB for distribution."],"tags":["gltf","uri","asset-path","buffer","bevy"],"backgroundTag":"invalid-asset-uri","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"}