# Error loading GLB file but GLTF file can be loaded correctly

**URL:** <https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251>\
**Category:** Bugs\
**Tags:** glb\
**Created:** [September 26, 2022, 8:38am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251 "2022-09-26T08:38:54Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [September 26, 2022, 8:38am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/1 "2022-09-26T08:38:54Z")

</div>

Hello,  
I call Babylon through Vue and import the required resources.

> import \* as BABYLON from ‘babylonjs’;  
> import ‘babylonjs-loaders’;

The GLTF model was successfully loaded and displayed on the web page, but an error was reported when the GLB format was loaded.  
Here’s the error:

> babylon.js?633b:1
> 
> ```
> BJS - [16:01:08]: Unable to load from static/gltftest/Tile_+001_+001.glb: RangeError: Offset is outside the bounds of the DataView
> 
> ```

This GLB model loads correctly on the sandbox, would be appreciated if anyone could figure out how to fix it.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 26, 2022, 1:55pm UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/2 "2022-09-26T13:55:47Z")

</div>

Hello and welcome to the Babylon community! Can you share with us your project and the model? We can’t say much on what is going on otherwise.

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [September 27, 2022, 1:30am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/5 "2022-09-27T01:30:27Z")

</div>

I really appreciate your help.Here is the model.  
[https://drive.google.com/file/d/1iIWZjm6CfUGxXbeMk\_yA\_lANhFsmv8hy/view?usp=sharing](https://drive.google.com/file/d/1iIWZjm6CfUGxXbeMk_yA_lANhFsmv8hy/view?usp=sharing)

My project:

```auto
<template>
  <div class="SanxiaModel">
    <!-- <div id="sanxiaModel"></div> -->
    <canvas id="sanxiaModel" style="width: 100%;height: 100%;"></canvas>

  </div>
</template>

<script>
  import * as BABYLON from 'babylonjs';
  import 'babylonjs-loaders';
  import * as GUI from 'babylonjs-gui';
  export default {
    name: 'SanxiaModel',

    data() {
      return {

      }
    },
    mounted() {
      this.init();
    },
    methods: {

      init() {
        // Get the canvas DOM element
        var canvas = document.getElementById('sanxiaModel');
        // Load the 3D engine
        var engine = new BABYLON.Engine(canvas, true, {
          preserveDrawingBuffer: true,
          stencil: true
        });
        // CreateScene function that creates and return the scene
        var createScene = function() {
          const scene = new BABYLON.Scene(engine);
          const camera = new BABYLON.ArcRotateCamera("camera", -Math.PI / 2, Math.PI / 2.5, 15, new BABYLON
            .Vector3(0, 0, 2000));
          camera.setTarget(BABYLON.Vector3.Zero());
          camera.attachControl(canvas, true);
          const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0));
          var advancedTexture = GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
          BABYLON.SceneLoader.ImportMesh("","static/gltftest/","Tile_+001_+001.glb",scene,function(mesh){
            console.log(mesh);
          })
          return scene;
        }
        // call the createScene function
        var scene = createScene();
        // run the render loop
        engine.runRenderLoop(function() {
          if (scene) {
            scene.render();
          }
        });
        // the canvas/window resize event handler
        window.addEventListener('resize', function() {
          engine.resize();
        });
      },
    }
  }
</script>

```

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 27, 2022, 11:07am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/6 "2022-09-27T11:07:23Z")

</div>

The model link doesn’t have access permissions ☹

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [September 27, 2022, 1:06pm UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/7 "2022-09-27T13:06:13Z")

</div>

Try this one  
[https://drive.google.com/file/d/1ElRXRFlKYAjDuUQF\_9RbJfmvNwZWqXw2/view?usp=sharing](https://drive.google.com/file/d/1ElRXRFlKYAjDuUQF_9RbJfmvNwZWqXw2/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 27, 2022, 3:52pm UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/8 "2022-09-27T15:52:49Z")

</div>

Your glb is working fine in the sandbox ([sandbox.babylonjs.com](http://sandbox.babylonjs.com)) so you should try to update to the latest babylon version ?

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [September 28, 2022, 12:43am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/9 "2022-09-28T00:43:05Z")

</div>

But I’m using the latest version

 ![捕获](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/4/4444e5cafc6934220336145701896c1a4889e346.png)

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [September 28, 2022, 1:47am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/10 "2022-09-28T01:47:00Z")

</div>

I recreated a Vue project with only the BabylonJS dependency package in it, and it was able to load my GLB model successfully. I think the previous error was due to the dependency package conflict.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 28, 2022, 12:45pm UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/11 "2022-09-28T12:45:35Z")

</div>

Possibly, if you had @bablyon/\* and babylon packages installed together this will cause conflicts.

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [September 29, 2022, 1:35am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/12 "2022-09-29T01:35:56Z")

</div>

But maybe not. I can’t find any conflicting packages from the original project 😵 🥲

 ![捕获](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/9/a9607c4591c44b160ddec70e88b7f57e1d954b0e.png)  
That seems to be no problem  
And I found that files with a.glb suffix would get an RangeError regardless of whether the file existed.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 29, 2022, 11:48am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/13 "2022-09-29T11:48:59Z")

</div>

That’s pretty strange… 🤔 Can you share your complete project? A github repository would be great.

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [September 30, 2022, 6:54am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/14 "2022-09-30T06:54:30Z")

</div>

This is my complete project:[https://github.com/xwmrzz/sanxia.git](https://github.com/xwmrzz/sanxia.git).  
The path to the model folder is public/static/gltftest and the path to the component is src/components/Model/ModelTest.vue

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 30, 2022, 12:08pm UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/15 "2022-09-30T12:08:56Z")

</div>

Sorry, but I’m not able to run your project, it seems most packages are very behind in version:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/8/7899447668645a6dc292edc4b83d4f4f9629533a.png)

But I’m able to load your model normally on the Playground: [Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#NWU9XS), so it really looks like there’s something on how your project is set up.

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [October 4, 2022, 9:11am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/16 "2022-10-04T09:11:02Z")

</div>

Anyway, thank you very much. I’ll try to find out what went wrong.

---

<div class="post-metadata">

**Author:** ![zkk](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/zkk/32/27125_2.png) [@zkk](https://forum.babylonjs.com/u/zkk)\
**Post date:** [October 9, 2022, 1:15pm UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/17 "2022-10-09T13:15:21Z")

</div>

This is very strange, the problem seems to be in the mocking.js file in the src folder. Normally this file has nothing to do with model loading, but when I delete this file my glb model loads successfully.

---

<div class="post-metadata">

**Author:** ![lilang](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lilang/32/37474_2.png) [@lilang](https://forum.babylonjs.com/u/lilang)\
**Post date:** [January 26, 2024, 8:22am UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/18 "2024-01-26T08:22:39Z")

</div>

Hello,I had the same problem,The model was loaded normally when vue2 was used previously,But I’m using vue3 and I don’t know if it’s a version issue, the model doesn’t load, and the error message is what you mentioned here,May I ask what the problem is?please

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [January 26, 2024, 12:09pm UTC](https://forum.babylonjs.com/t/error-loading-glb-file-but-gltf-file-can-be-loaded-correctly/34251/19 "2024-01-26T12:09:51Z")

</div>

Can you share your project?
