Exit Status 0 After Connection Issues

Advertisement

JamesB
Joined:
Posts:
4

Exit Status 0 After Connection Issues

Hi,
I'm using WinSCP from the command line. We recently had issues with uploading files to an endpoint where their server allowed our connection but then could not continue due to issues on their end.

Both log files had "Waiting for data timed out, asking user what to do" after the "Connected to " the remote host IP address. One time the last message in the log file was "Script: Server unexpectedly closed network connection", the other time it was "Script: Timeout waiting for server to respond".

The business partner that receives these files acknowledged they were having some issues, and these problems appear to have been resolved.

My question is, why did WinSCP return a status 0 on exit when these issues happened? Neither log file included the normal "Script: Exit code 0" or "Session sent command exit status 0", but the application's exit status code was 0 so our check in the script did not alert us to the errors.

Thanks,
JamesB

Reply with quote

Advertisement

JamesB
Joined:
Posts:
4

Re: Exit Status 0 After Connection Issues

The portions of the logs with the errors are below.
. 2025-10-14 04:00:05.029 --------------------------------------------------------------------------
< 2025-10-14 04:00:05.042 Script: Searching for host...
. 2025-10-14 04:00:05.061 Looking up host "sftp.datapartner.endpoint" for SSH connection
. 2025-10-14 04:00:05.123 Connecting to 12.34.56.789 port 22
. 2025-10-14 04:00:05.139 Connected to 12.34.56.789
< 2025-10-14 04:00:05.139 Script: Connecting to host...
. 2025-10-14 04:00:05.139 We claim version: SSH-2.0-WinSCP_release_6.3.6
. 2025-10-14 04:00:05.139 Connected to 12.34.56.789
. 2025-10-14 04:00:21.595 Waiting for data timed out, asking user what to do.
. 2025-10-14 04:00:21.626 Asking user:
. 2025-10-14 04:00:21.626 **Host is not communicating for 15 seconds.
. 2025-10-14 04:00:21.626 
. 2025-10-14 04:00:21.626 Wait for another 15 seconds?** ()
< 2025-10-14 04:00:21.642 Script: Host is not communicating for more than 15 seconds.
< 2025-10-14 04:00:21.642 Still waiting...
< 2025-10-14 04:00:21.642 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2025-10-14 04:00:21.642 Warning: Aborting this operation will close connection!
. 2025-10-14 04:01:36.176 Answer: No
. 2025-10-14 04:01:36.223 Attempt to close connection due to fatal exception:
* 2025-10-14 04:01:36.223 **Timeout waiting for server to respond.**
. 2025-10-14 04:01:36.223 Closing connection.
< 2025-10-14 04:01:36.254 Script: Timeout waiting for server to respond.

. 2025-10-16 04:00:06.627 --------------------------------------------------------------------------
< 2025-10-16 04:00:06.627 Script: Searching for host...
. 2025-10-16 04:00:06.627 Looking up host "sftp.datapartner.endpoint" for SSH connection
. 2025-10-16 04:00:07.099 Connecting to 12.34.56.789 port 22
. 2025-10-16 04:00:07.114 Connected to 12.34.56.789
< 2025-10-16 04:00:07.114 Script: Connecting to host...
. 2025-10-16 04:00:07.114 We claim version: SSH-2.0-WinSCP_release_6.3.6
. 2025-10-16 04:00:07.114 Connected to 12.34.56.789
. 2025-10-16 04:00:23.557 Waiting for data timed out, asking user what to do.
. 2025-10-16 04:00:23.557 Asking user:
. 2025-10-16 04:00:23.557 **Host is not communicating for 15 seconds.
. 2025-10-16 04:00:23.557 
. 2025-10-16 04:00:23.557 Wait for another 15 seconds?** ()
< 2025-10-16 04:00:23.557 Script: Host is not communicating for more than 15 seconds.
< 2025-10-16 04:00:23.557 Still waiting...
< 2025-10-16 04:00:23.557 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2025-10-16 04:00:23.557 Warning: Aborting this operation will close connection!
. 2025-10-16 04:00:55.477 Data has arrived, closing query to user.
. 2025-10-16 04:00:55.477 Answer: OK
. 2025-10-16 04:00:55.477 Remote side unexpectedly closed network connection
. 2025-10-16 04:00:55.477 Knocking FTP port.
. 2025-10-16 04:00:57.827 FTP port did not open.
< 2025-10-16 04:00:57.827 Script: Server unexpectedly closed network connection.

Thanks,
James

Reply with quote

JamesB
Joined:
Posts:
4

Re: Exit Status 0 After Connection Issues

Sorry for the delay.
. 2025-10-14 04:00:05.013 --------------------------------------------------------------------------
. 2025-10-14 04:00:05.013 WinSCP Version 6.3.6 (Build 15073 2024-11-25) (OS 10.0.20348 – Windows Server 2022 Standard)
. 2025-10-14 04:00:05.013 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2025-10-14 04:00:05.013 Log level: Normal
. 2025-10-14 04:00:05.013 Local account: localdomain\accountname
. 2025-10-14 04:00:05.013 Working directory: C:\temp\10132025
. 2025-10-14 04:00:05.013 Process ID: 16120
. 2025-10-14 04:00:05.029 Ancestor processes: WinSCP, cmd, ...
. 2025-10-14 04:00:05.029 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=6.3.6 /consoleinstance=_9536_484 "/script=C:\wscp\send-partner-data.wscp" "/parameter" "10132025" "/log=C:\logs\winscp.txt" "/loglevel=0" 
. 2025-10-14 04:00:05.029 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/9/2025, DST End: 11/2/2025
. 2025-10-14 04:00:05.029 Login time: Tuesday, October 14, 2025 4:00:05 AM
. 2025-10-14 04:00:05.029 --------------------------------------------------------------------------
. 2025-10-14 04:00:05.029 Script: Retrospectively logging previous script records:
> 2025-10-14 04:00:05.029 Script: option batch abort
< 2025-10-14 04:00:05.029 Script: batch           abort     
> 2025-10-14 04:00:05.029 Script: option confirm off
< 2025-10-14 04:00:05.029 Script: confirm         off       
> 2025-10-14 04:00:05.029 Script: open sftp://sftpusername:***@sftp.datapartner.endpoint:22
. 2025-10-14 04:00:05.029 --------------------------------------------------------------------------
. 2025-10-14 04:00:05.029 Session name: sftpusername@sftp.datapartner.endpoint (Ad-Hoc site)
. 2025-10-14 04:00:05.029 Host name: sftp.datapartner.endpoint (Port: 22)
. 2025-10-14 04:00:05.029 User name: sftpusername (Password: Yes, Key file: No, Passphrase: No)
. 2025-10-14 04:00:05.029 Tunnel: No
. 2025-10-14 04:00:05.029 Transfer Protocol: SFTP
. 2025-10-14 04:00:05.029 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2025-10-14 04:00:05.029 Disable Nagle: No
. 2025-10-14 04:00:05.029 Proxy: None
. 2025-10-14 04:00:05.029 Send buffer: 262144
. 2025-10-14 04:00:05.029 Compression: No
. 2025-10-14 04:00:05.029 Bypass authentication: No
. 2025-10-14 04:00:05.029 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2025-10-14 04:00:05.029 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2025-10-14 04:00:05.029 Ciphers: aes,chacha20,aesgcm,3des,WARN,des,blowfish,arcfour; Ssh2DES: No
. 2025-10-14 04:00:05.029 KEX: ntru-curve25519,ecdh,dh-gex-sha1,dh-group18-sha512,dh-group17-sha512,dh-group16-sha512,dh-group15-sha512,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2025-10-14 04:00:05.029 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2025-10-14 04:00:05.029 Simple channel: Yes
. 2025-10-14 04:00:05.029 Return code variable: Autodetect; Lookup user groups: Auto
. 2025-10-14 04:00:05.029 Shell: default
. 2025-10-14 04:00:05.029 EOL: LF, UTF: Auto
. 2025-10-14 04:00:05.029 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2025-10-14 04:00:05.029 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2025-10-14 04:00:05.029 SFTP Bugs: Auto,Auto
. 2025-10-14 04:00:05.029 SFTP Server: default
. 2025-10-14 04:00:05.029 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2025-10-14 04:00:05.029 Cache directory changes: Yes, Permanent: Yes
. 2025-10-14 04:00:05.029 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2025-10-14 04:00:05.029 DST mode: Unix
. 2025-10-14 04:00:05.029 --------------------------------------------------------------------------
< 2025-10-14 04:00:05.042 Script: Searching for host...
. 2025-10-14 04:00:05.061 Looking up host "sftp.datapartner.endpoint" for SSH connection
. 2025-10-14 04:00:05.123 Connecting to 12.34.56.789 port 22
. 2025-10-14 04:00:05.139 Connected to 12.34.56.789
< 2025-10-14 04:00:05.139 Script: Connecting to host...
. 2025-10-14 04:00:05.139 We claim version: SSH-2.0-WinSCP_release_6.3.6
. 2025-10-14 04:00:05.139 Connected to 12.34.56.789
. 2025-10-14 04:00:21.595 Waiting for data timed out, asking user what to do.
. 2025-10-14 04:00:21.626 Asking user:
. 2025-10-14 04:00:21.626 **Host is not communicating for 15 seconds.
. 2025-10-14 04:00:21.626 
. 2025-10-14 04:00:21.626 Wait for another 15 seconds?** ()
< 2025-10-14 04:00:21.642 Script: Host is not communicating for more than 15 seconds.
< 2025-10-14 04:00:21.642 Still waiting...
< 2025-10-14 04:00:21.642 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2025-10-14 04:00:21.642 Warning: Aborting this operation will close connection!
. 2025-10-14 04:01:36.176 Answer: No
. 2025-10-14 04:01:36.223 Attempt to close connection due to fatal exception:
* 2025-10-14 04:01:36.223 **Timeout waiting for server to respond.**
. 2025-10-14 04:01:36.223 Closing connection.
< 2025-10-14 04:01:36.254 Script: Timeout waiting for server to respond. 

. 2025-10-16 04:00:06.612 --------------------------------------------------------------------------
. 2025-10-16 04:00:06.612 WinSCP Version 6.3.6 (Build 15073 2024-11-25) (OS 10.0.20348 – Windows Server 2022 Standard)
. 2025-10-16 04:00:06.612 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2025-10-16 04:00:06.612 Log level: Normal
. 2025-10-16 04:00:06.612 Local account: localdomain\accountname
. 2025-10-16 04:00:06.612 Working directory: C:\temp\10152025
. 2025-10-16 04:00:06.612 Process ID: 17764
. 2025-10-16 04:00:06.627 Ancestor processes: WinSCP, cmd, ...
. 2025-10-16 04:00:06.627 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=6.3.6 /consoleinstance=_16820_415 "/script=C:\wscp\send-partner-data.wscp" "/parameter" "10152025" "/log=C:\logs\winscp.txt" "/loglevel=0" 
. 2025-10-16 04:00:06.627 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/9/2025, DST End: 11/2/2025
. 2025-10-16 04:00:06.627 Login time: Thursday, October 16, 2025 4:00:06 AM
. 2025-10-16 04:00:06.627 --------------------------------------------------------------------------
. 2025-10-16 04:00:06.627 Script: Retrospectively logging previous script records:
> 2025-10-16 04:00:06.627 Script: option batch abort
< 2025-10-16 04:00:06.627 Script: batch           abort     
> 2025-10-16 04:00:06.627 Script: option confirm off
< 2025-10-16 04:00:06.627 Script: confirm         off       
> 2025-10-16 04:00:06.627 Script: open sftp://sftpusername:***@sftp.datapartner.endpoint:22 
. 2025-10-16 04:00:06.627 --------------------------------------------------------------------------
. 2025-10-16 04:00:06.627 Session name: sftpusername@sftp.datapartner.endpoint (Ad-Hoc site)
. 2025-10-16 04:00:06.627 Host name: sftp.datapartner.endpoint (Port: 22)
. 2025-10-16 04:00:06.627 User name: sftpusername (Password: Yes, Key file: No, Passphrase: No)
. 2025-10-16 04:00:06.627 Tunnel: No
. 2025-10-16 04:00:06.627 Transfer Protocol: SFTP
. 2025-10-16 04:00:06.627 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2025-10-16 04:00:06.627 Disable Nagle: No
. 2025-10-16 04:00:06.627 Proxy: None
. 2025-10-16 04:00:06.627 Send buffer: 262144
. 2025-10-16 04:00:06.627 Compression: No
. 2025-10-16 04:00:06.627 Bypass authentication: No
. 2025-10-16 04:00:06.627 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2025-10-16 04:00:06.627 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2025-10-16 04:00:06.627 Ciphers: aes,chacha20,aesgcm,3des,WARN,des,blowfish,arcfour; Ssh2DES: No
. 2025-10-16 04:00:06.627 KEX: ntru-curve25519,ecdh,dh-gex-sha1,dh-group18-sha512,dh-group17-sha512,dh-group16-sha512,dh-group15-sha512,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2025-10-16 04:00:06.627 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2025-10-16 04:00:06.627 Simple channel: Yes
. 2025-10-16 04:00:06.627 Return code variable: Autodetect; Lookup user groups: Auto
. 2025-10-16 04:00:06.627 Shell: default
. 2025-10-16 04:00:06.627 EOL: LF, UTF: Auto
. 2025-10-16 04:00:06.627 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2025-10-16 04:00:06.627 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2025-10-16 04:00:06.627 SFTP Bugs: Auto,Auto
. 2025-10-16 04:00:06.627 SFTP Server: default
. 2025-10-16 04:00:06.627 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2025-10-16 04:00:06.627 Cache directory changes: Yes, Permanent: Yes
. 2025-10-16 04:00:06.627 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2025-10-16 04:00:06.627 DST mode: Unix
. 2025-10-16 04:00:06.627 --------------------------------------------------------------------------
< 2025-10-16 04:00:06.627 Script: Searching for host...
. 2025-10-16 04:00:06.627 Looking up host "sftp.datapartner.endpoint" for SSH connection
. 2025-10-16 04:00:07.099 Connecting to 12.34.56.789 port 22
. 2025-10-16 04:00:07.114 Connected to 12.34.56.789
< 2025-10-16 04:00:07.114 Script: Connecting to host...
. 2025-10-16 04:00:07.114 We claim version: SSH-2.0-WinSCP_release_6.3.6
. 2025-10-16 04:00:07.114 Connected to 12.34.56.789
. 2025-10-16 04:00:23.557 Waiting for data timed out, asking user what to do.
. 2025-10-16 04:00:23.557 Asking user:
. 2025-10-16 04:00:23.557 **Host is not communicating for 15 seconds.
. 2025-10-16 04:00:23.557 
. 2025-10-16 04:00:23.557 Wait for another 15 seconds?** ()
< 2025-10-16 04:00:23.557 Script: Host is not communicating for more than 15 seconds.
< 2025-10-16 04:00:23.557 Still waiting...
< 2025-10-16 04:00:23.557 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2025-10-16 04:00:23.557 Warning: Aborting this operation will close connection!
. 2025-10-16 04:00:55.477 Data has arrived, closing query to user.
. 2025-10-16 04:00:55.477 Answer: OK
. 2025-10-16 04:00:55.477 Remote side unexpectedly closed network connection
. 2025-10-16 04:00:55.477 Knocking FTP port.
. 2025-10-16 04:00:57.827 FTP port did not open.
< 2025-10-16 04:00:57.827 Script: Server unexpectedly closed network connection. 
Thanks,
JamesB

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Exit Status 0 After Connection Issues

Thanks for log. I've tested the same scenario. And while WinSCP indeed does not log the exit code in this case, the exit code is still 1, as expected. How are you checking the exit code?

Reply with quote

JamesB
Joined:
Posts:
4

Re: Exit Status 0 After Connection Issues

I'm using the line below to check, followed by the local commands and a closing parenthesis:
if %ERRORLEVEL% neq 0 (
Thanks,
JamesB

Reply with quote

martin
Site Admin
martin avatar

Re: Exit Status 0 After Connection Issues

Thanks. Works for me. Can you post complete batch file (or at least the previous part that runs WinSCP)?
Is the problem easy to reproduce?

Reply with quote

Advertisement

You can post new topics in this forum