Error: rootElement already set, need to specify override

Hi,

I got this error,

Error: rootElement already set, need to specify override

when executing this,

var task= this.modeler.get(‘elementRegistry’).get(this.currentTaskId);
this.modeler.get(‘selection’).select(task);

I’m using the above code to do the auto focus of an event, the code will be executed after importing the bpmn.io diagram,

const url = ‘/assets/processlet/bpmn/initial.bpmn’;
this.http.get(url, {
headers: {observe: ‘response’}, responseType: 'text’
}).subscribe(
(x: any) => {
console.log('Fetched XML, now importing: ', x);
this.modeler.importXML(x, this.handleError);
},
this.handleError
);

please help me out to fix this error,

Thanks & Regards,
Siva

Close this thread as it seems to be a duplicate of this.