# Loading GLTF with armature fails (Float32Array on ArrayBuffer error)

**URL:** <https://discourse.threejs.org/t/loading-gltf-with-armature-fails-float32array-on-arraybuffer-error/52638>\
**Category:** Questions\
**Tags:** gltf-loader, loaders, gltf\
**Created:** [June 10, 2023, 7:06am UTC](https://discourse.threejs.org/t/loading-gltf-with-armature-fails-float32array-on-arraybuffer-error/52638 "2023-06-10T07:06:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junisek](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@Junisek](https://discourse.threejs.org/u/Junisek)\
**Post date:** [June 10, 2023, 7:06am UTC](https://discourse.threejs.org/t/loading-gltf-with-armature-fails-float32array-on-arraybuffer-error/52638/1 "2023-06-10T07:06:34Z")

</div>

Hello, I’m trying to import a skinned mesh to my project. The project was set up and was working fine with an old mesh but once I created a new one it stopped working - but, only when I include armature.

I’m sending the mesh from a php server over REST API base64 encoded.

```javascript
$uri = base64_encode(file_get_contents($gltf));

```

In JS, I’m then decoding it and parsing. As I said, it works totally fine with the same mesh but without armature.

```javascript
const mesh = atob(encodedData);

const loader = new THREE.GLTFLoader();

loader.parse(
      mesh,
      "/models/",
      (gltf) => {
        console.log("loaded", gltf);
      },
      (error) => {
        console.log("An error happened", error);
      }
    );

```

Then I get the

`RangeError: attempting to construct out-of-bounds Float32Array on ArrayBuffer.`

I consulted with ChatGPT and it suggested this

```javascript
const bufferLength = mesh.length;
const arrayBuffer = new ArrayBuffer(bufferLength);
const uintArray = new Uint8Array(arrayBuffer);

for (let i = 0; i < bufferLength; i++) {
    uintArray[i] = mesh.charCodeAt(i);
}

loader.parse(
      arrayBuffer,
      "/models/",
      (gltf) => {
        console.log("loaded", gltf);
      },
      (error) => {
        console.log("An error happened", error);
      }
    );

```

Which gives me the same error. I also tried to stringify the decoded data as I noticed the data represent differently in the console (black - mesh with no armature, pink - mesh with armature).

![Snímek obrazovky 2023-06-09 v 19.51.46](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/4/c/4c62f5c1ee1f312b05febfa22fec91431805ad8b.png)  
 ![Snímek obrazovky 2023-06-09 v 19.51.40](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/7/2729e54c6cf34a571c548d8fbebac6fcf6b98ab1.png)

When I stringify (with or without the ArrayBuffer conversions), I get this error:

`Error: THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`

But the mesh is GLTF.2. It loads fine using Don Mc Curdys GLTF viewer. This is the report

 ![Snímek obrazovky 2023-06-10 v 9.00.46](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/6/e/6eb112ecaa87445349ae4ff404fca5f3290b3372.png)

To clarify, I’m using Aframe on version 1.3.0, when I tried the latest version, it fails as well but silently so I’m using the older version for sake of debugging.

Thank you for your suggestions, it’s driving me crazy!
