unable to download file via SFTP

Advertisement

_timbo_
Joined:
Posts:
3

unable to download file via SFTP

Hi,
There is an external server which I'm connecting to via SFTP. I can connect fine using the GUI, view files, and download them.
When trying to download from code I get the dreaded error code 4. I can connect and ListDirectory fine, but get an error whether trying to GetFiles all at once, or one at a time.
This is everything from the log up to the first Error Code 4.
Any ideas?
Thanks
[2021-03-26 11:55:42.749] [0001] .NET Framework build
[2021-03-26 11:55:42.749] [0001] Executing assembly: WinSCPnet, Version=1.6.5.10071, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf
[2021-03-26 11:55:42.749] [0001] Executing assembly codebase: file:///C:/Programs/FileTransfers/WinSCPnet.DLL
[2021-03-26 11:55:42.749] [0001] Executing assembly location: C:\Programs\FileTransfers\WinSCPnet.dll
[2021-03-26 11:55:42.749] [0001] Entry Assembly: FileTransfers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[2021-03-26 11:55:42.749] [0001] Operating system: Microsoft Windows NT 6.2.9200.0
[2021-03-26 11:55:42.749] [0001] Timezone: 00:00; GMT Standard Time
[2021-03-26 11:55:42.749] [0001] User: xxxxxxxxxxxxx; Interactive: True
[2021-03-26 11:55:42.749] [0001] Runtime: 4.0.30319.42000
[2021-03-26 11:55:42.749] [0001] Console encoding: Input: Western European (DOS) (850); Output: Western European (DOS) (850)
[2021-03-26 11:55:42.749] [0001] Working directory: C:\Programs\FileTransfers
[2021-03-26 11:55:42.749] [0001] Assembly path: C:\Programs\FileTransfers\WinSCPnet.DLL
[2021-03-26 11:55:42.749] [0001] Assembly product version: 5.15.9.0
[2021-03-26 11:55:42.796] [0001] Session.GetFiles entering
[2021-03-26 11:55:42.796] [0001]   Command: [get  -nopermissions -preservetime -transfer="binary" -- "processing//processing/000000000013 (1).TXT" "C:\Temp\"]
[2021-03-26 11:55:42.796] [0001]   ExeSessionProcess.ExecuteCommand entering
[2021-03-26 11:55:42.796] [0001]   ExeSessionProcess.ExecuteCommand leaving
[2021-03-26 11:55:42.796] [0001]   SessionLogReader.Read entering
[2021-03-26 11:55:42.796] [0001]     Waiting for log update and dispatching events for 50
[2021-03-26 11:55:42.796] [0001]     Output: [winscp> pwd]
[2021-03-26 11:55:42.796] [0001]     Output: [/]
[2021-03-26 11:55:42.796] [0004] Scheduling output: [winscp> get  -nopermissions -preservetime -transfer="binary" -- "processing//processing/000000000013 (1).TXT" "C:\Temp\"]
[2021-03-26 11:55:42.796] [0001]     Output: [winscp> get  -nopermissions -preservetime -transfer="binary" -- "processing//processing/000000000013 (1).TXT" "C:\Temp\"]
[2021-03-26 11:55:42.796] [0004] Releasing communication structure
[2021-03-26 11:55:42.796] [0004] Released communication structure
[2021-03-26 11:55:42.796] [0004] 2nd generation collection count: 1
[2021-03-26 11:55:42.796] [0004] Total memory allocated: 5251504
[2021-03-26 11:55:42.796] [0004] Waiting for request event
[2021-03-26 11:55:42.827] [0004] Got request event
[2021-03-26 11:55:42.827] [0004] ExeSessionProcess.ProcessEvent entering
[2021-03-26 11:55:42.827] [0004]   Acquiring communication structure
[2021-03-26 11:55:42.827] [0004]   Acquired communication structure
[2021-03-26 11:55:42.827] [0004]   Print: 000000000013 (1).TXT      |            0 B |    0.0 KB/s | binary |   0%
[2021-03-26 11:55:42.827] [0004]   Buffered from-beginning message [000000000013 (1).TXT      |            0 B |    0.0 KB/s | binary |   0%]
[2021-03-26 11:55:42.827] [0004]   Got incomplete progress output
[2021-03-26 11:55:42.827] [0004]   Releasing communication structure
[2021-03-26 11:55:42.827] [0004]   Released communication structure
[2021-03-26 11:55:42.827] [0004] ExeSessionProcess.ProcessEvent leaving
[2021-03-26 11:55:42.827] [0004] 2nd generation collection count: 1
[2021-03-26 11:55:42.827] [0004] Total memory allocated: 5267888
[2021-03-26 11:55:42.827] [0004] Waiting for request event
[2021-03-26 11:55:42.859] [0001]     Read 168 bytes from log
[2021-03-26 11:55:42.859] [0001]     Read node 20: Whitespace 
  
[2021-03-26 11:55:42.859] [0001]     Log contents:
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="http://winscp.net/schema/session/1.0" name="xxxxxxxx@xxxxxxxxxxxxxx" start="2021-03-26T11:55:40.249Z">
  <group name="open sftp://F30788AB:***@xxxxxxxxxxxxxx:22 -hostkey=&quot;ssh-rsa 2048 5zt6BTseLlT+Cs5cnp8PBjQwM/dLa738BeXSsHeCaag=&quot; -timeout=15" start="2021-03-26T11:55:42.078Z">
  </group>
  <group name="pwd" start="2021-03-26T11:55:42.749Z">
    <cwd>
      <cwd value="/" />
      <result success="true" />
    </cwd>
  </group>
  <group name="get  -nopermissions -preservetime -transfer=&quot;binary&quot; -- &quot;processing//processing/000000000013 (1).TXT&quot; &quot;C:\Temp\&quot;" start="2021-03-26T11:55:42.796Z">

[2021-03-26 11:55:42.859] [0001]   SessionLogReader.Read leaving
[2021-03-26 11:55:42.859] [0001]   SessionLogReader.Read entering
[2021-03-26 11:55:42.859] [0001]     Read 25 bytes from log
[2021-03-26 11:55:42.859] [0001]     Read node 21: Element group
[2021-03-26 11:55:42.859] [0001]     Log contents has not changed
[2021-03-26 11:55:42.859] [0001]   SessionLogReader.Read leaving
[2021-03-26 11:55:42.859] [0001]   Session.CreateProgressHandler entering
[2021-03-26 11:55:42.859] [0001]   Session.CreateProgressHandler leaving
[2021-03-26 11:55:42.859] [0001]   SessionLogReader.Read entering
[2021-03-26 11:55:42.859] [0001]     Waiting for log update and dispatching events for 50
[2021-03-26 11:55:42.921] [0001]     Waiting for log update and dispatching events for 100
[2021-03-26 11:55:42.937] [0004] 2nd generation collection count: 1
[2021-03-26 11:55:42.937] [0004] Total memory allocated: 5325220
[2021-03-26 11:55:42.937] [0004] Waiting for request event
[2021-03-26 11:55:43.031] [0001]     Waiting for log update and dispatching events for 200
[2021-03-26 11:55:43.046] [0004] 2nd generation collection count: 1
[2021-03-26 11:55:43.046] [0004] Total memory allocated: 5333400
[2021-03-26 11:55:43.046] [0004] Waiting for request event
[2021-03-26 11:55:43.062] [0004] Got request event
[2021-03-26 11:55:43.062] [0004] ExeSessionProcess.ProcessEvent entering
[2021-03-26 11:55:43.062] [0004]   Acquiring communication structure
[2021-03-26 11:55:43.062] [0004]   Acquired communication structure
[2021-03-26 11:55:43.062] [0004]   Print: 
Copying files from remote side failed.
General failure (server should provide error description).
Error code: 4
Error message from server: 
Common reasons for the Error code 4 are:
- Renaming a file to a name of already existing file.
- Creating a directory that already exists.
- Moving a remote file to a different filesystem (HDD).
- Uploading a file to a full filesystem (HDD).
- Exceeding a user disk quota.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: unable to download file via SFTP

Can you download those files anyhow? In WinSCP GUI? In any other SFTP client?

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

_timbo_
Joined:
Posts:
3

I have noticed today that the host has a \processing subfolder. I cannot download from this, but I can download from the root folder using the GUI.
I have tried comparing the settings in the GUI with the property settings in the API but can't notice any obvious differences.
I am unable to download from the root folder using the API, I have attached the log. Is it possible that the API is recursive and is failing due to the processing folder?
Thanks,
Tim
  • ftp_0876d229-59b9-498e-bb30-98224bb2095c.log (14.53 KB, Private file)

Reply with quote

_timbo_
Joined:
Posts:
3

As a further update, rather than risking any recursive action I have also listed the files successfully via the API but then it still fails to download a single named file (log attached for both the list and the get).
Thanks for your help.
Tim
  • ftp_709a3bad-b8bf-4f97-9338-69a3a72310b3.log (45.22 KB, Private file)
  • ftp_ea39332b-0600-43bf-9e3a-d70728c15e38.log (14.76 KB, Private file)

Reply with quote

martin
Site Admin
martin avatar

Neither of the three debug logs you have posted show any file transfer.
And I've asked for a session log file anyway.
Additionally please post a session log file from GUI showing the successful transfer.

Reply with quote

Advertisement

You can post new topics in this forum