Error: Invalid argument to date encode

Advertisement

NottaSmartMan
Joined:
Posts:
36

Error: Invalid argument to date encode

I'm getting an error of "Invalid argument to date encode [12832-11-1]" when I try to upload a file via SFTP. It looks like the reason is because there's no "modified" date for the file.

I get this error in the WinSCP GUI (see attachment) as well as when synchronizing folders via script. Pretty cool situation, but I'm not sure what to do.

Setting the timestamp to a default time (matching the created date?) would be fine with me if possible.

Currently, this just abort. From a script, I get the following output:
< 2024-11-03 23:15:05.642 Script: Invalid argument to date encode [12832-09-17 08:18:46.136]
. 2024-11-03 23:15:05.643 Script: Failed
. 2024-11-03 23:15:05.643 Session upkeep
. 2024-11-03 23:15:05.643 Looking for network events
. 2024-11-03 23:15:05.643 Timeout waiting for network events
> 2024-11-03 23:15:05.781 Script: exit
  • ErrorWIthNoModDate.png (144.5 KB, Private file)

Reply with quote

Advertisement

NottaSmartMan
Joined:
Posts:
36

In this case, the source file is located on a Network/UNC path.

However, I was able to copy the file locally and retain the "no modification date'.

Attached is a picture showing the 'no modification date' in explorer and how windows represents it when you look at the file properties.
  • NoModDate2.png (130.97 KB, Private file)

Reply with quote

martin
Site Admin
martin avatar

Re: Error: Invalid argument to date encode

So the 12832 year seems to be the actual modification date of the file. The Explorer probably just fails to be able to display it in the file list.
Does the file upload, if you do not ask for preserving the timestamp?

Reply with quote

NottaSmartMan

Correct, it transfers fine if I do NOT preserve the timestamp.

It only errors if I do try to preserve the timestamp (be it via powershell script or using the standard WinSCP GUI)

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Ok, WinSCP indeed supports dates up to 9999 year only.
Making it support later dates is quite some work and I do not really think it's worth the effort. Sorry.
Even more so considering, that most SFTP servers support dates up to 2038 only anyway.

Reply with quote

NottaSmartMan
Joined:
Posts:
36

Would it be possible to just have WinSCP ignore/skip the attempt to preserve the timestamp rather than just error out?

With such an odd last-modified date so far in the future, I'd be okay with the script just skipping the time setting step for that single file rather than crashing.

I suppose this would be considered more of a feature request than a bug at this point. I've only run across one file like this so far, so I'd say the priority is low. I did save a copy of it for future testing if need be though.

Reply with quote

Advertisement

You can post new topics in this forum