# Error connecting controller

**URL:** <https://discuss.hotwired.dev/t/error-connecting-controller/3973>\
**Category:** General\
**Created:** [March 28, 2022, 6:52pm UTC](https://discuss.hotwired.dev/t/error-connecting-controller/3973 "2022-03-28T18:52:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kris](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@kris](https://discuss.hotwired.dev/u/kris)\
**Post date:** [March 28, 2022, 6:52pm UTC](https://discuss.hotwired.dev/t/error-connecting-controller/3973/1 "2022-03-28T18:52:16Z")

</div>

I have created a form with a few Stimulus controllers. When I visited the page, there are no errors in the console, but if I navigate to another page and back again, there is a error in the console:  
Error connecting controller  
Error: Missing target element “companylogo” for “imageupload” controller

It seems like the Stimulus controllers are loaded twice during the second visit.

First visit:  
application #starting [app:1749:21]  
reveal #initialize [app:1749:21]  
reveal #connect [app:1749:21]  
application #start

Second visit:  
reveal #disconnect [app:1749:21]  
reveal #initialize [app:1749:21]  
reveal #connect [app:1749:21]  
reveal #disconnect [app:1749:21]  
reveal #initialize [app:1749:21]  
reveal #connect

Is this behaviour due to a bug in Turbo / Hotwire, or a configuration issue?

---

<div class="post-metadata">

**Author:** ![kris](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@kris](https://discuss.hotwired.dev/u/kris)\
**Post date:** [March 30, 2022, 3:35pm UTC](https://discuss.hotwired.dev/t/error-connecting-controller/3973/2 "2022-03-30T15:35:19Z")

</div>

Found the solution here: [Controller initialized twice when visiting from a Turbolinks page](https://discuss.hotwired.dev/t/controller-initialized-twice-when-visiting-from-a-turbolinks-page/17)
