# After 23 attempts, failed to spawn pexpect session

**URL:** <https://forum.ansible.com/t/after-23-attempts-failed-to-spawn-pexpect-session/35513>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [July 16, 2021, 12:42pm UTC](https://forum.ansible.com/t/after-23-attempts-failed-to-spawn-pexpect-session/35513 "2021-07-16T12:42:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suneel\_Hegde](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Suneel\_Hegde](https://forum.ansible.com/u/Suneel_Hegde)\
**Post date:** [July 16, 2021, 12:42pm UTC](https://forum.ansible.com/t/after-23-attempts-failed-to-spawn-pexpect-session/35513/1 "2021-07-16T12:42:37Z")

</div>

ello All,  
we are trying to copy NXOS image using ansible  
getting this error when we ran the playbook form the AWX  
anyone please help what is causing this issuefatal: [switch]: FAILED! =\> {  
“msg”: “After 23 attempts, failed to spawn pexpect session to switchBEFORE: None, AFTER: None”  
}this is the the configuration

- name: COPY\_NXOS\_IMAGE\_USING\_SCP  
nxos\_file\_copy:  
file\_pull: True  
local\_file: “{{new\_nxos\_image}}”  
remote\_file: “/root/networkscript/nexus-image/{{new\_nxos\_image}}”  
remote\_scp\_server: “{{scp\_server}}”  
remote\_scp\_server\_user: “{{scp\_server\_username}}”  
remote\_scp\_server\_password: “{{scp\_server\_password}}”  
vrf: “management”  
timeout: 600  
vars:  
ansible\_command\_timeout: 30

when: ansible\_network\_os == ‘nxos’

Thank you  
Suneel
