# handling BadHostKeyException?

**URL:** <https://forum.ansible.com/t/handling-badhostkeyexception/23177>\
**Category:** Ansible Developer\
**Created:** [December 6, 2016, 6:01am UTC](https://forum.ansible.com/t/handling-badhostkeyexception/23177 "2016-12-06T06:01:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim1](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Tim1](https://forum.ansible.com/u/Tim1)\
**Post date:** [December 6, 2016, 6:01am UTC](https://forum.ansible.com/t/handling-badhostkeyexception/23177/1 "2016-12-06T06:01:03Z")

</div>

Is anyone aware of how to handle the below exception in the \*\_command network modules?

-tim

File “/var/folders/jc/9d1188j962931rhqrlm4173w5j5m45/T/ansible\_bLe9q4/ansible\_modlib.zip/ansible/module\_utils/shell.py”, line 226, in connect  
File “/var/folders/jc/9d1188j962931rhqrlm4173w5j5m45/T/ansible\_bLe9q4/ansible\_modlib.zip/ansible/module\_utils/shell.py”, line 96, in open  
File “/Users/trupp/src/envs/ansible-2.0/lib/python2.7/site-packages/paramiko/client.py”, line 366, in connect  
raise BadHostKeyException(hostname, server\_key, our\_server\_key)  
paramiko.ssh\_exception.BadHostKeyException: (‘localhost’, \<paramiko.rsakey.RSAKey object at 0x10daa5990\>, \<paramiko.rsakey.RSAKey object at 0x10d9fa850\>)
