Cant get attribute of file!

Advertisement

PenkiP
Joined:
Posts:
6
Location:
United States

Cant get attribute of file!

I understand there are multiple posts on here with the same issue, but I was really hoping for help on my situation since I couldn't figure mine out looking at them. I'm stuck and would really appreciate any/all help!

I'm using the WinSCP dll and trying to download files from an SFTP server. And occasionally (almost 20%) of the times see this issue. Could you please help.

When I look at the debug log, it looks like its got all the info (attributes it needs), attaching a scrubbed log here. PLEASE HELP:

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,852
Location:
Prague, Czechia

Re: Cant get attribute of file!

Is the problem random? Or does it happen with some specific files only?
Please attach a full session log file (using the latest version of WinSCP) showing both successful and failed transfer. If the problem is random, please make sure you post both logs for the same file.

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

PenkiP
Joined:
Posts:
6
Location:
United States

Re: Cant get attribute of file!

Hi Martin,

It has been random. In fact, this week, when the process ran through script using the WinSCPnet.dll, it failed (session log attached – named – Failed_SessionLog_01072024.log). But when I manually opened the WinSCP GUI and ran it, it ran fine, and downloaded the file. I tried both "Copy Here" and "Move Here" options through the WinSCP UI app and both options worked fine for the same file that the dll method failed for! Unfortunately, this is a Production script and I'm not able to deploy the latest dll to Prod yet, so will have to send you these logs with the version of the dll I currently use. But I plan on upgrading to the latest dll version this weekend.

I have also attached another session log that downloaded a different file from the same site, from a different folder. With the same exact credentials. I have seen this fail in the past too, but this last week, it ran successfully and I have attached the session log for it. I understand that you wanted session log of the same file for both success and failure, but I'm not able to reproduce the issue at will unfortunately, and so the next best thing I'm able to do, is to provide the closest second option of a successful transfer from the same site, from the same day, just from a different folder (and this file also randomly fails, just happened to succeed this time around).

Thanks in Advance!
Description: Success Session Log!
Description: Failed Session log!

Reply with quote

martin
Site Admin
martin avatar

Re: Cant get attribute of file!

Either the file does not exist – I assume you didn't made up the file, right? I assume it is some file from the previous directory listing. Isn't it possible the the file was deleted from the server between the listing and the attempt to delete it?

Another option is a bug in the server.

Reply with quote

PenkiP
Joined:
Posts:
6
Location:
United States

Re: Cant get attribute of file!

Hi Martin,

I haven't made the file up. Its a vendor file and they put it out there and they say there is no permissions issue there. And once they put their file out there, they don't touch it again! The strange part is that when I transfer it manually i.e., using the WinSCP app, it worked in one of the instances. And that's what confuses me. Do you see any other reason this could happen? Or are you sure that the logs would've shown you if there was any issues? I dont think there is anything else in the code I'm doing wrong, but do you think I could be doing something in the code that's causing this issues? (although I imagine that if that was the case, we would have seen it in the logs?!).

I'm really stuck! Please help!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,852
Location:
Prague, Czechia

Re: Cant get attribute of file!

I cannot help you much here.
You will have do some tests yourself to narrow down the problem.
Did you try immediately retrying the failed download? And after some delay? Did you try listing the directory again immediately after the download failed? Would the listing include the file or not? (all in your code)

Reply with quote

PenkiP
Joined:
Posts:
6
Location:
United States

Re: Cant get attribute of file!

Hi Martin,

Thanks again for your quick replies! I just got one last request for you, to please look at these NEW session logs. This time, these logs are exactly how you asked them for. It's for the same file on the same day (3 hours apart), from the same location. But one of the logs is for a successful run and another one is for a failure run. Please look into it and see if this clears any. I do see a difference in line 183 (size), does this tell you anything more?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,852
Location:
Prague, Czechia

Re: Cant get attribute of file!

The difference is not (primarily) in size, but in response type. In the Failure log, the server responds with error-status response (SSH_FXP_STATUS), while in the Success log, the server responds with SSH_FXP_ATTRS.

All I can tell from the log is that in the Failure case, it looks like the file does not exist. While in the Success case, it does.

Reply with quote

PenkiP
Joined:
Posts:
6
Location:
United States

Re: Cant get attribute of file!

Thanks Martin! I will reach out to the site admin, as it looks like a bug on their side from all of our conversation here. Also, there is a DMZ gateway in the middle, through which all the traffic gets routed. I wonder if that somehow is causing issues too. Either way, I appreciate you looking into it.

Thanks again!

Reply with quote

Advertisement

PenkiP
Joined:
Posts:
6
Location:
United States

Re: Cant get attribute of file!

Hi Martin,

I have reopened this chat, as it is now happening on every other site as well, which tells me its not a site problem. I changed my code a bit and here's the error message I see:
WinSCP.SessionRemoteException: Can't get attributes of file '/FolderPath/2024-01-10 09:04:14.906423_Corp_File.csv'. No such file or directory. Error code: 2 Error message from server: at WinSCP.OperationResultBase.Check() at CallSite.Target(Closure , CallSite , Object )
This is a different site I'm pulling files from and this also throws the same error on random files and when I re-run my process, it get fixed and some other files show this error. Please Help!

Is there something in my code I might be doing wrong? I'm using the
session.GetFiles($SrcPath, $destPath, $False, $transferOptions)
to get a named file from the server.

Reply with quote

Advertisement

You can post new topics in this forum