# Getting error message using ml5js with p5js

**URL:** <https://discourse.processing.org/t/getting-error-message-using-ml5js-with-p5js/24980>\
**Category:** Libraries\
**Created:** [October 28, 2020, 6:56pm UTC](https://discourse.processing.org/t/getting-error-message-using-ml5js-with-p5js/24980 "2020-10-28T18:56:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maddyna](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@maddyna](https://discourse.processing.org/u/maddyna)\
**Post date:** [October 28, 2020, 6:56pm UTC](https://discourse.processing.org/t/getting-error-message-using-ml5js-with-p5js/24980/1 "2020-10-28T18:56:12Z")

</div>

the errors I got:

Uncaught TypeError: Cannot read property ‘split’ of undefined (: line 57)  
model is loaded  
Error: Failed to execute ‘texImage2D’ on ‘WebGL2RenderingContext’: The image element contains cross-origin data, and may not be loaded.

my code:

let mobilenet;  
let img;

function modelLoaded(){

console.log(‘model is loaded’);  
mobilenet.predict(img,gotresult);

}  
function gotresult(error,result){  
if(error){  
console.error(error)

}else{  
console.log(result);  
}  
}  
function setup() {  
createCanvas(400, 400);  
img=createImg(‘birds/bird.png’);

mobilenet=ml5.imageClassifier(‘MobileNet’,modelLoaded)  
}

function draw() {  
background(220);  
}

please tell me how do I work it out .

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [October 28, 2020, 10:40pm UTC](https://discourse.processing.org/t/getting-error-message-using-ml5js-with-p5js/24980/2 "2020-10-28T22:40:57Z")

</div>

Hi,

Remember that it’s always useful to make a search on internet with the error message because it’s more likely that someone got the same issue 😉 :

> <https://github.com/ml5js/ml5-library/issues/217>
>
> In my example https://ideanb.github.io/best-guess/
> I can classify images in the same server such as
> images/dexter1.jpg
> images/dexter2.jpg
> images/dee2.jpg
> images/dee4.jpg
> But, If I try to classify an external link,...

Note : also try to format your code by using the `</>` button in the message editor, you can edit your original message to change that

Hope it helps!
