Missing model error when attaching in HOOPS Web Viewer

Hi Team,

I’m running into an error when trying to attach a model in HOOPS Web Viewer:

Uncaught (in promise) yd: Missing model: ‘TS051.scs’
    at _attached (hoops-web-viewer.mjs:43847:1)
    at Mv.unsafeTrigger (hoops-web-viewer.mjs:9245:1)
    ...

From what I understand, the viewer is not able to locate the TS051.scs file.
Here’s what I’ve already checked:
Model is present on server in a folder from where SC server is searching for the models.

Still, the viewer throws this error.

Could you please guide me on this.

Thanks in advance for your support!

Hello,

Can you please share the specific functions you are calling to load the model?

Thanks,
Tino

if (rendererType === RendererType.Server) {
console.log(‘server’);
viewer = new WebViewer({
containerId: divId,
endpointUri,
model: model?.modelName,
rendererType: rendererType,
});
} else if (defaultModel) {
console.log('data - ', endpointUri, model, rendererType, defaultModel);
viewer = new WebViewer({
containerId: divId,
endpointUri,
model: model?.modelName,
rendererType: rendererType,
});
} else {
viewer = new WebViewer({
containerId: divId,
empty: true,
});
}

Running in SSR mode in second if else

You cannot load an SCS file in an SSR session as this type of session requires a SC/SCZ file. If you want to load an SCS file, you will need to switch to CSR and use endpointUri, for example:

endpointUri: 'TS051.scs',

And remove modelName.

second block of else if is SCS session and i am loading scs files TS051.

this is enpointUri using internal routing by spawnId - ws://localhost:8082/ca04f475-0786-4b4c-9071-5b7ba203cc6a

and modelName is “TS051.scs”

Is your code based off of one of our projects/sandboxes? If so, can you tell me which one?

No. This is our client project.

The error i am getting is viewer specific or sc server specific?

If the second else statement handles loading the SCS, your code is actually hitting the first else statement because defaultModel is true. In this clause, the WebViewer configuration is set up to load an SC/SCZ file not an SCS.

For the second else, let’s try something like this to load an SCS:

} else {
viewer = new WebViewer({
containerId: divId,
endpointUri: model?.modelName,
rendererType: rendererType //Needs to be CSR not SSR
});

As a test, force defaulModel to false.

I Tested multiple times with combinations to load models into the viewer what I observed is that -

  1. In CSR mode -
    1. when modelName set to TS051.scs - the TS051.scs model as well as TS051.scz model both throws “Missing Model TS051.scs”
    2. when modelName set to TS051.scz - the TS051.scs model throws “Missing Model TS051.scz” but the TS051.scz loads perfectly
  2. In SSR mode - No matter what you set viewer always gets freeze before loading the model

It’s unclear to me what “…as well as TS051.scz model” means – given that the modelName to load TS051.scs? It sounds like you have logic to try load an SCZ even if the model is SCS?

Lets make it simple.

In SSR Mode -

I want to say that in below code I set modelName TS051.scs to load that scs model. but its giving error that missing model TS051.scs even if that model is present in the folder. So then I just replaced the TS051.scs model with TS051.scz model in that folder and changed the modelName to TS051.scz its get loaded into the viewer.

viewer = new WebViewer({
containerId: divId,
endpointUri: model?.modelName,
rendererType: rendererType //Needs to be CSR not SSR
});

but in CSR mode scs models should be able to load no? Instead scz models are loading in CSR mode properly.

In SSR Mode - Viewer getting feeze even I try to load scz models

I have a couple of suggestions:

  • SCS files, because they are file-based, are in different directory folders than Stream Cache. These folders are managed by fileServerStaticDirs in the server configuration file. Please see HOOPS_Communicator_2025.X.x\quick_start\server_config.js for an example.
  • You can try creating the WebViewer configuration based on whether the model file is SCS or SC/SCZ. Below is a code snippet:
if (model?.modelName?.endsWith('.scs')) {
  console.log('SCS');
  viewer = new WebViewer({
    containerId: divId,
    endpointUri: modelName
  });
} else {
  console.log('data - ', endpointUri, model, rendererType, defaultModel);
  viewer = new WebViewer({
    containerId: divId,
    endpointUri: endpoint,
    model: model?.modelName,
    rendererType: rendererType,
  });
}

Is modelName full path to the scs model present on server in if block? So, no server-side rendering?

The modelName does not have to be the full path. If the SCS is in a subfolder, it can be something like:

endpointUri: "data/myModel.scs"

SSR and CSR is controlled by rendererType: rendererType. SSR should work too in the else statement because the WebViewer config will be the same for both SSR and CSR.