Data Migration issue

I am currently in the process of completing a data migration of two self-hosted Octopus servers in to one, however we are running in to an issue at the point of the import to the main server.
The error log is below and highlights padding being an issue, however I have looked through the Octopus documentation + forums and cannot see anything related to the specific issue being highlighted or mentioned.

The major versions of Octopus are the same, 2022.2, with the build versions differing:
Build v6764 – Export
Build v6729 – Import

The databases are the same (although on different servers) using the same collation and running on SQL server 2017.

Executable directory is C:\Program Files\Octopus Deploy\Octopus
Executable name or full path: Octopus.Migrator.exe
No user context provided. Running as current user.
Starting Octopus.Migrator.exe in working directory ‘C:\Program Files\Octopus Deploy\Octopus’ using ‘Western European (DOS)’ encoding running as ‘PARENTPAY\david.carthy.admin’ with the same environment variables as the launching process
Error: Padding is invalid and cannot be removed.
Error: System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
Error: at Internal.Cryptography.UniversalCryptoDecryptor.GetPaddingLength(ReadOnlySpan1 block) Error: at Internal.Cryptography.UniversalCryptoDecryptor.UncheckedTransformFinalBlock(ReadOnlySpan1 inputBuffer, Span1 outputBuffer) Error: at Internal.Cryptography.UniversalCryptoDecryptor.UncheckedTransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) Error: at Internal.Cryptography.UniversalCryptoTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) Error: at System.Security.Cryptography.CryptoStream.FlushFinalBlockAsync(Boolean useAsync, CancellationToken cancellationToken) Error: at System.Security.Cryptography.CryptoStream.FlushFinalBlock() Error: at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing) Error: at System.IO.Stream.Close() Error: at System.IO.Stream.Dispose() Error: at Octopus.Core.Security.MasterKey.MasterKeyEncryption.ToPlaintext(Byte[] masterKey, EncryptedBytes encrypted) in ./source/Octopus.Core/Security/MasterKey/MasterKeyEncryption.cs:line 74 Error: at Octopus.Core.Security.MasterKey.StoredMasterKeyEncryption.ToPlaintext(EncryptedBytes encrypted) in ./source/Octopus.Core/Security/MasterKey/StoredMasterKeyEncryption.cs:line 71 Error: at Octopus.Core.Security.MasterKey.MasterKeyEncryptionExtensionMethods.ToPlaintextString(IMasterKeyEncryption encryption, EncryptedBytes encrypted) in ./source/Octopus.Core/Security/MasterKey/MasterKeyEncryptionExtensionMethods.cs:line 21 Error: at Octopus.Core.RelationalStorage.TypeHandlers.SensitiveStringConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in ./source/Octopus.Core/RelationalStorage/TypeHandlers/SensitiveStringConverter.cs:line 55 Error: at Octopus.Core.RelationalStorage.TypeHandlers.SensitiveStringTypeHandler.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in ./source/Octopus.Core/RelationalStorage/TypeHandlers/SensitiveStringTypeHandler.cs:line 58 Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType) Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor1 creator, String id)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
Error: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
Error: at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
Error: at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
Error: at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
Error: at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
Error: at Octopus.Migrator.Cli.Commands.ImportFilesCommand.Start() in ./source/Octopus.Migrator.Cli/Commands/ImportFilesCommand.cs:line 113
Error: at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in ./source/Octopus.Shared/Startup/AbstractCommand.cs:line 100
Error: at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 500
Error: at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in ./source/Octopus.Shared/Startup/ConsoleHost.cs:line 34
Error: at Octopus.Shared.Startup.OctopusProgram.RunHost(ICommandHost host) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 217
Error: at Octopus.Shared.Startup.OctopusProgram.Run() in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 168
Error: Sensitive data in this export cannot be decrypted
Error: This usually happens when you use the wrong password when importing. Check the password and try importing again. If that doesn’t work, try exporting again and make sure to use the same password for both the export and import.
Error: See: “Data Migration - Octopus Deploy
Error: "-------------------------------------------------------------------------------
Error: Terminating process with exit code 100
Error: Full error details are available in the log files at:
Error: C:\Users\david.carthy.admin\AppData\Local\Octopus\Logs
Error: E:\Octopus\Logs
Error: If you need help, please send these log files to Help & Support - Octopus Deploy
Error: -------------------------------------------------------------------------------
Error: "
Process Octopus.Migrator.exe in C:\Program Files\Octopus Deploy\Octopus exited with code 100
Error: The previous command returned a non-zero exit code of: 100
Error: The command that failed was: “C:\Program Files\Octopus Deploy\Octopus\Octopus.Migrator.exe” import --instance “OctopusServer” --directory “C:\Exports\OctopusExtractDev” --password “dCarthy-Octop****” --dry-run

Hi @david_carthy,

Thank you for contacting Octopus Support.

The error looks like an issue with decoding sensitive information with the password provided in the import. If you copy/pasted the password and it contains a single quote ', make sure it isn’t pasting in as the fancy quotes. There may be other characters as well with similar nuances to watch for.

Additionally, an alternative we recommend for migrating Projects is our Project Import/Export feature. This works differently than Octopus Migrator and you may find this easier to use.

Let me know if it looks like the password is the issue at your earliest convenience.

Best Regards,
Donny Bell

Hi Donny,
Thank you for coming back to me so quickly!
The password doesn’t use single quotes however does use two hyphens, are special characters to be avoided?


Hi @david_carthy,

Thank you for the quick response.

It is possible the double-hyphen could be the issue. I know in some cases a double-hyphen will turn into a single horizontal bar (or long dash).

Are you able to try a different password on the Export and see if you still have the same issue when Importing?

Let me know at your earliest convenience.

Best Regards,
Donny Bell

Hi Donny,
I did try a completely incorrect password and the same error occurs, backing up your thoughts. I will attempt a new export without special characters.

Thank you again for responding so quickly.

Kind regards,

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.