# After 23 attempts, failed to spawn pexpect session error

**URL:** <https://forum.ansible.com/t/after-23-attempts-failed-to-spawn-pexpect-session-error/35511>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [July 16, 2021, 3:49am UTC](https://forum.ansible.com/t/after-23-attempts-failed-to-spawn-pexpect-session-error/35511 "2021-07-16T03:49:50Z")\
**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, 3:49am UTC](https://forum.ansible.com/t/after-23-attempts-failed-to-spawn-pexpect-session-error/35511/1 "2021-07-16T03:49:50Z")

</div>

Hello Team,

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  
regards  
Suneel
