InvalidOperationException - Invalid decoder state.

0 votes
asked Mar 26, 2012 by Daniel James Bryars (120 points)
edited Dec 5, 2013

We've been using Rebex to transfer sFtp files and we've just had the following exception whilst transferring a file. Please can you tell me what this means?

Source :

Exception Type :

Exception Message :
Invalid decoder state.

Stack Trace :
   at wWGvS.AIchsYZ.AcUJKJ(Byte[] )
   at Rebex.Net.SshSession.AePCoRZ(Byte[]& )
   at Rebex.Net.SshSession.cDtmAOZ(cMbfbTZ , Object[] )
   at Rebex.Net.SshChannel.Receive(Byte[] buffer, Int32 offset, Int32 count)
   at wWGvS.AzRMspZ.BMJzdYZ(Byte[] , Int32 , Int32 )
   at wWGvS.APnbEo.BXQTfX(Int32 )
   at wWGvS.APnbEo.CFLiXJ(BBdsJfZ& )
   at wWGvS.APnbEo.CFLiXJ(UInt32 )
   at wWGvS.APnbEo.BdgSrC(UInt32 )
   at Rebex.Net.Sftp.CipxfYZ(AYPecc , String , Stream , Int64 , Int64 )
   at FtpClientRebex.SFtp.GetFileInternal(FtpParameters parameters, String sourcePathAndFilename, Int32 maxSizeBytes, Stream stream) in c:\BuildAgent1\work\Trunk\LiquidStudio\FtpClientRebex\SFtp.cs:line 28
   at FtpClientRebex.FtpClient.GetFile(FtpParameters parameters, String sourcePathAndFilename, Int32 maxSizeBytes) in c:\BuildAgent1\work\Trunk\LiquidStudio\FtpClientRebex\FtpClient.cs:line 49
   at FtpRuntime.FtpRuntime.CopyToLpeFileSystem(String ftpDetailsModelName, String sourceFilePath, String destinationFilePath, Nullable`1 timeOutSecondsForTransfer) in c:\BuildAgent1\work\Trunk\LiquidHtml\LiquidHtmlServerSideDfmlRuntime\FtpRuntime.cs:line 155

5 Answers

0 votes
answered Mar 27, 2012 by Lukas Pokorny (126,870 points)
edited Mar 27, 2012

This is thrown when an SSH packet decoder/decryptor enters an unusable state and should never occur under normal circumstances. Did this only happen once, or are you able to reproduce it? Also, are you simply calling a single GetFile method, or are there multiple operations on the samve Sftp object running at the same time?

0 votes
answered Aug 31, 2012 by RobIII (180 points)
edited Apr 18, 2013

Had the same problem today:

Invalid decoder state.
   at gbMKS.mAgm5Z.j6i9L(Byte[] )
   at Rebex.Net.SshSession.JZ4YLZ(Byte[]& )
   at Rebex.Net.SshSession.1rsOcLZ(1VEj6UZ , Object[] )
   at Rebex.Net.SshChannel.1rsOcLZ(Boolean , 1VEj6UZ , Object[] )
   at Rebex.Net.SshChannel.Receive(Byte[] buffer, Int32 offset, Int32 count)
   at gbMKS.uuA26Z.1IsOQMZ(Byte[] , Int32 , Int32 )
   at gbMKS.PEQpz.1oSQZR(Int32 )
   at gbMKS.PEQpz.2aErfC(1dRwomZ& )
   at gbMKS.PEQpz.2aErfC(UInt32 )
   at gbMKS.PEQpz.1eDJCS(UInt32 )
   at Rebex.Net.Sftp.2bVMHOZ(udycp , String , Stream , Int64 , Int64 , 27NpLhZ )
   at Rebex.Net.Sftp.2bVMHOZ(FileMode , udycp , String , String , Int64 , Int64 , Int64 , 27NpLhZ )
   at Rebex.Net.Sftp.GetFile(String remotePath, String localPath)
   at COINImport.COINDownloader.DownloadFiles(NetworkCredential credentials, String hostname, Int32 port, IEnumerable`1 files, String destdir, String dateformat)
   at COINImport.Program.Main(String[] args)

For now, this has only occured once. Should it happen again I will let you know.

commented Aug 31, 2012 by Lukas Pokorny (126,870 points)
edited Aug 31, 2012

Thanks for letting us know! We are currently finalizing the next release of Rebex components which should report a more meaningful error instead of the old "Invalid decoder state".

commented Nov 2, 2012 by Lukas Pokorny (126,870 points)
edited Nov 2, 2012

In the latest release - - a more meaningful error should be reported instead of this.

commented Apr 18, 2013 by RobIII (180 points)
edited Apr 18, 2013

I am still getting the same error, even with the r3 release (3.0.4700.0).

commented Apr 18, 2013 by Tomas Knopp (58,890 points)
edited Apr 18, 2013

Could you please create a verbose log as descibed here.

Make sure you assign the LogWriter property just before the call to the failing GetFile method (otherwise the log would contain also password, username, etc...) and either send the log to or post it here. Thank you.

0 votes
answered Jun 5, 2013 by RobIII (180 points)
edited Jun 5, 2013

We have switched to SSH.Net. It's free¤ and works fine for our purposes. Sorry. The Rebex component failed on a random basis; it was scheduled (as part of a program) to download several files (ranging from <100KB to max. ~70MB) every morning; 4 out of 7 mornings (sometimes more) it would just fail for no reason. SSH.Net, downloading the same files at the same time works flawlessley.

¤ Our Rebex license also expired and we looked for alternatives and found this one...

commented Jun 5, 2013 by Lukas Pokorny (126,870 points)
edited Jun 5, 2013

No problem, good luck and don't hesitate to reconsider Rebex SFTP in the future if you run into any issues with SSH.Net!

0 votes
answered Jun 5, 2013 by Lukas Pokorny (126,870 points)
edited Jun 5, 2013

Important notice:

If you are experiencing the same issue, please let us know about it! This isn't something that happens very often (it can be triggered by disposing an Sftp object while an operation is running, for example), which means we need a bit of your cooperation in order to determine what is going on and possibly fix a bug if there actually is one.

If possible, try creating a simple application that triggers the error and mail it to us for analysis. Once we are able to reproduce the issue, I'm sure we would be able to solve it (or fix the bug) within several days. Thanks!

+1 vote
answered Dec 5, 2013 by Lukas Matyska (60,690 points)
edited Dec 5, 2013

The "Invalid decoder state" arises in case of some connection failures. From Version 2013 R3 the error should be reported as "Connection failure".