BabylonJS/Babylon.js · error
Loading from ArrayBufferView can not be used with plugins th
Error message
Loading from ArrayBufferView can not be used with plugins that don't support binary loading.
What it means
Some loader plugins can only consume URLs/streams, not raw binary buffers. When rawData (an ArrayBufferView) is supplied and the resolved plugin does not declare isBinary support, SceneLoader throws this error instead of silently failing later.
Source
Thrown at packages/dev/core/src/Loading/sceneLoader.ts:712
registeredPlugin = getPluginForMimeType(mimeType);
}
}
if (!registeredPlugin) {
registeredPlugin = getDefaultPlugin();
}
}
if (!registeredPlugin) {
throw new Error(`No plugin or fallback for ${pluginExtension ?? fileInfo.url}`);
}
if (pluginOptions?.[registeredPlugin.plugin.name]?.enabled === false) {
throw new Error(`The '${registeredPlugin.plugin.name}' plugin is disabled via the loader options passed to the loading operation.`);
}
if (fileInfo.rawData && !registeredPlugin.isBinary) {
throw new Error("Loading from ArrayBufferView can not be used with plugins that don't support binary loading.");
}
// For plugin factories, the plugin is instantiated on each SceneLoader operation. This makes options handling
// much simpler as we can just pass the options to the factory, rather than passing options through to every possible
// plugin call. Given this, options are only supported for plugins that provide a factory function.
let plugin: SceneLoaderPlugin;
if (IsFactory(registeredPlugin.plugin)) {
const pluginFactory = registeredPlugin.plugin;
try {
// Only await when the factory is actually asynchronous, so that for synchronous factories the plugin is
// instantiated (and onPluginActivatedObservable is notified) synchronously within the calling load operation.
const createdPlugin = pluginFactory.createPlugin((pluginOptions ?? {}) as SceneLoaderPluginOptions);
plugin = createdPlugin instanceof Promise ? await createdPlugin : createdPlugin;
} catch (error) {
throw createLoadError(fileInfo, "Error instantiating plugin.", error);
}
} else {
plugin = registeredPlugin.plugin;
View on GitHub (pinned to 0592b347b8)
Solutions
- Convert the ArrayBuffer to a text string (TextDecoder) or to a Blob/File URL for non-binary plugins.
- Use a binary-capable format/plugin (e.g. .glb instead of .gltf text) when feeding raw buffers.
- Check the plugin's isBinary flag before choosing the raw-data loading path.
Example fix
// before
const buf = await (await fetch("model.obj")).arrayBuffer();
await SceneLoader.LoadDataAsync("", buf, scene, null, "obj"); // throws: obj plugin is not binary
// after
const text = await (await fetch("model.obj")).text();
await SceneLoader.LoadAsync("", text, scene, null, "obj"); Defensive patterns
Strategy: validation
Validate before calling
const binaryCapable = new Set(["glb"]);
if (isRawData(data) && pluginExtension && !binaryCapable.has(pluginExtension)) {
throw new Error(`Cannot feed raw ArrayBufferView to text-based plugin '${pluginExtension}'`);
} Type guard
function isRawData(d: unknown): d is ArrayBufferView {
return d !== null && typeof d === "object" && (ArrayBuffer.isView(d) || d instanceof ArrayBuffer);
} Try / catch
try {
await BABYLON.SceneLoader.LoadDataAsync("", buf, scene, null, ext, "");
} catch (e) {
if ((e as Error).message.includes("binary loading")) {
console.error(`Plugin '${ext}' cannot consume raw binary; decode to text or use a binary format`);
}
} Prevention
- Use .glb (binary) rather than .gltf/.obj text formats when loading from buffers.
- Decode text formats with TextDecoder or load them via URL/File instead of raw bytes.
- Check plugin.isBinary support before choosing the raw-data path.
When it happens
Trigger: Passing an ArrayBufferView as data to LoadDataAsync/ImportMesh while the matched pluginExtension corresponds to a text-based plugin (e.g. .obj or .stl plugin without binary support).
Common situations: Pre-fetching model bytes with fetch().arrayBuffer() then loading them with a text-format plugin; switching a load call from a URL to in-memory data without checking plugin capabilities.
Related errors
- When using ArrayBufferView to load data the file extension m
- No scene available to import mesh to
- Cannot load file: a valid scene filename or root url was not
- No scene available to append to
- No plugin or fallback for ${pluginExtension ?? fileInfo.url}
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/6e7b611c865a55f9.
Report an issue: GitHub.