# Odd Error in Loading OBJ

**URL:** <https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181>\
**Category:** Questions\
**Created:** [February 4, 2019, 9:38pm UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181 "2019-02-04T21:38:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 4, 2019, 9:38pm UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/1 "2019-02-04T21:38:06Z")

</div>

Not sure if this is a bug, or if I am doing something wrong.

[http://pryme8.com/pbr-demo/](http://pryme8.com/pbr-demo/)

Unhandled expression at line : babylonjs.loaders.min.js:16

Not really sure what is going on, so I figured I would delete the MTL reference in the OBJ file and bam it works…

Why do we have it make the scene fail compilation if a mtl file is missing when referenced in the OBJ… shouldn’t we just have an console error pop up and move on to parsing the mesh anyways?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 4, 2019, 10:06pm UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/2 "2019-02-04T22:06:32Z")

</div>

pinging @brianzinn as he did improve that recently 🙂

---

<div class="post-metadata">

**Author:** ![brianzinn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brianzinn/32/28013_2.png) [@brianzinn](https://forum.babylonjs.com/u/brianzinn)\
**Post date:** [February 4, 2019, 11:10pm UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/3 "2019-02-04T23:10:01Z")

</div>

hi, You are not doing anything wrong! That was a bug introduced when the MTL files were put in a promises array, which in turned now calls the onSuccess() callback. Previously the onSuccess() would trigger when the OBJ loaded and the materials would download async (after onSuccess). Not sure when that was bug was introduced, sometime ~3.3. I quite coincidentally found that issue yesterday and have a PR nearly ready, if I can stop working on my regular job for 30 minutes… I am slammed with work. Will get it in for sure next couple of days. cheers.

---

<div class="post-metadata">

**Author:** ![brianzinn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brianzinn/32/28013_2.png) [@brianzinn](https://forum.babylonjs.com/u/brianzinn)\
**Post date:** [February 5, 2019, 12:39am UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/4 "2019-02-05T00:39:01Z")

</div>

Also, @Deltakosh - for true backwards compatibility with older versions we should have silent failing **on** as default option, whereas I have it configured **off** by default (to match current behaviour). I can bring it up in the PR comments, if you want to think about it.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 5, 2019, 12:52am UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/5 "2019-02-05T00:52:44Z")

</div>

I agree 🙂 this is the best option

---

<div class="post-metadata">

**Author:** ![Galen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/galen/32/539_2.png) [@Galen](https://forum.babylonjs.com/u/Galen)\
**Post date:** [February 5, 2019, 5:23am UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/6 "2019-02-05T05:23:19Z")

</div>

@Pryme8

Come on Dude, don’t you call your friends anymore? Anyway, a search would have retrieved the answer quickly, but it’s great than @Deltakosh and @brianzinn are always paying attention.

Galen

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [February 5, 2019, 5:09pm UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/7 "2019-02-05T17:09:51Z")

</div>

Yaas, I do my phone has been out of commision for days though… (thank god)

Ill call you when I go to the store and get a new charger today… I have not really been in a rush because being disconnected from the world has been a blessing.

---

<div class="post-metadata">

**Author:** ![brianzinn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brianzinn/32/28013_2.png) [@brianzinn](https://forum.babylonjs.com/u/brianzinn)\
**Post date:** [February 5, 2019, 9:49pm UTC](https://forum.babylonjs.com/t/odd-error-in-loading-obj/1181/8 "2019-02-05T21:49:35Z")

</div>

Should be fixed with no code changes on next drop (PR 5867).
