{"record":{"id":"6e7b611c865a55f9","repo":"BabylonJS/Babylon.js","slug":"loading-from-arraybufferview-can-not-be-used-with","errorCode":null,"errorMessage":"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.","messagePattern":"Loading from ArrayBufferView can not be used with plugins that don't support binary loading\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Loading/sceneLoader.ts","lineNumber":712,"sourceCode":"                registeredPlugin = getPluginForMimeType(mimeType);\r\n            }\r\n        }\r\n\r\n        if (!registeredPlugin) {\r\n            registeredPlugin = getDefaultPlugin();\r\n        }\r\n    }\r\n\r\n    if (!registeredPlugin) {\r\n        throw new Error(`No plugin or fallback for ${pluginExtension ?? fileInfo.url}`);\r\n    }\r\n\r\n    if (pluginOptions?.[registeredPlugin.plugin.name]?.enabled === false) {\r\n        throw new Error(`The '${registeredPlugin.plugin.name}' plugin is disabled via the loader options passed to the loading operation.`);\r\n    }\r\n\r\n    if (fileInfo.rawData && !registeredPlugin.isBinary) {\r\n        throw new Error(\"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.\");\r\n    }\r\n\r\n    // For plugin factories, the plugin is instantiated on each SceneLoader operation. This makes options handling\r\n    // much simpler as we can just pass the options to the factory, rather than passing options through to every possible\r\n    // plugin call. Given this, options are only supported for plugins that provide a factory function.\r\n    let plugin: SceneLoaderPlugin;\r\n    if (IsFactory(registeredPlugin.plugin)) {\r\n        const pluginFactory = registeredPlugin.plugin;\r\n        try {\r\n            // Only await when the factory is actually asynchronous, so that for synchronous factories the plugin is\r\n            // instantiated (and onPluginActivatedObservable is notified) synchronously within the calling load operation.\r\n            const createdPlugin = pluginFactory.createPlugin((pluginOptions ?? {}) as SceneLoaderPluginOptions);\r\n            plugin = createdPlugin instanceof Promise ? await createdPlugin : createdPlugin;\r\n        } catch (error) {\r\n            throw createLoadError(fileInfo, \"Error instantiating plugin.\", error);\r\n        }\r\n    } else {\r\n        plugin = registeredPlugin.plugin;\r","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Loading/sceneLoader.ts#L694-L730","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nconst buf = await (await fetch(\"model.obj\")).arrayBuffer();\nawait SceneLoader.LoadDataAsync(\"\", buf, scene, null, \"obj\"); // throws: obj plugin is not binary\n\n// after\nconst text = await (await fetch(\"model.obj\")).text();\nawait SceneLoader.LoadAsync(\"\", text, scene, null, \"obj\");","handlingStrategy":"validation","validationCode":"const binaryCapable = new Set([\"glb\"]);\nif (isRawData(data) && pluginExtension && !binaryCapable.has(pluginExtension)) {\n  throw new Error(`Cannot feed raw ArrayBufferView to text-based plugin '${pluginExtension}'`);\n}","typeGuard":"function isRawData(d: unknown): d is ArrayBufferView {\n  return d !== null && typeof d === \"object\" && (ArrayBuffer.isView(d) || d instanceof ArrayBuffer);\n}","tryCatchPattern":"try {\n  await BABYLON.SceneLoader.LoadDataAsync(\"\", buf, scene, null, ext, \"\");\n} catch (e) {\n  if ((e as Error).message.includes(\"binary loading\")) {\n    console.error(`Plugin '${ext}' cannot consume raw binary; decode to text or use a binary format`);\n  }\n}","preventionTips":["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."],"tags":["loading","scene-loader","binary-data","validation"],"backgroundTag":"binary-data-unsupported","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}