# Random webGL error

**URL:** <https://forum.babylonjs.com/t/random-webgl-error/37997>\
**Category:** Questions\
**Created:** [February 7, 2023, 12:02pm UTC](https://forum.babylonjs.com/t/random-webgl-error/37997 "2023-02-07T12:02:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichalZr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/michalzr/32/12671_2.png) [@MichalZr](https://forum.babylonjs.com/u/MichalZr)\
**Post date:** [February 7, 2023, 12:02pm UTC](https://forum.babylonjs.com/t/random-webgl-error/37997/1 "2023-02-07T12:02:29Z")

</div>

Hello,  
so in our app, sometimes we get `WebGL: INVALID_OPERATION: uniform1i: location not for current program`.  
It happens:

- seemingly randomly, roughly 1 out of 20 times I open the app
- only during initialization (when I open the app)

Does anyone have some tips on how to isolate this issue, or even better - how to resolve it? I can’t reproduce it reliably, so it’s really hard to fix.

Note: we have a material that extends the `PBRCustomMaterial` and the problem is probably somewhere there.

Any tips appreciated.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 7, 2023, 12:45pm UTC](https://forum.babylonjs.com/t/random-webgl-error/37997/2 "2023-02-07T12:45:44Z")

</div>

That’s very hard to tell without a repro.

Are you using `scene.executeWhenReady` before starting the real work? Maybe it can help making sure everything is in order before going on.

Note that `uniform1i` is used to set a INT uniform, so if your custom shader is using an INT as an uniform the problem probably comes from it (but I’m not able to tell how it can happen…).
