TypeError: Cannot read properties of undefined (reading ‘fetchStack’) when loading .glb model with Three.js and Vite

I’m working on a project using Vite, Three.js and Bootstrap where I’m trying to load a .glb model. My project structure is as follows:

├── public/
│   ├── models/
│   │   └── Flamingo.glb
├── src/
│   ├── js/
│   │   └── main.js
│   └── scss/
│   |   └── styles.scss
|   └── index.html
├── package-lock.json
├── package.json
└── vite.config.js

I’m loading the model using GLTFLoader in main.js:

import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';

const loader = new GLTFLoader();

  gltf => console.log(gltf.scene),
  error => console.error(error)

When I run my server, I get a 200 OK status for the model URL. However, I’m encountering the following error:

TypeError: Cannot read properties of undefined (reading ‘fetchStack’)
at _0x3131c3.Response.. [as arrayBuffer] (eval at (localhost/:1:76), :1:41458)

Here is my vite configuation:

import { resolve } from 'path'

export default {
  root: resolve(__dirname, 'src'),
  publicDir: '../public',
  build: {
    outDir: '../dist'
  server: {
    port: 5173

I’ve tried various solutions including checking the Three.js version, verifying CORS settings, and ensuring asynchronous operations are handled correctly, but the error persists.

Look in the devtools console and see what requests are being sent? Is your model draco-compressed? Does any other model load ok (for ex. some simple GLTF cube exported from Blender with default settings) ?

Thanks for the reply! I restarted my pc and the error was gone, the model information is displayed correctly. Idk what happened

Stumbled upon this after Googling – this has started happening for me too. It sometimes fixes itself when I first start the server up after a long break, but then starts happening again. What’s really strange is that it happens across different browsers, and across different projects with different stacks (Vue, React). MacBook running Sonama 14.0. Projects that were previously running just fine are now impacted. Only impacts projects when ran locally, and always the same fetchStack undefined error.

I have a suspicion it might be VSCode related…