Error: Key not valid for use in specified state. Unable to start / install Octopus Deploy

Octopus Deploy was working a couple days ago, then just stopped after I rebooted the server. Here’s the error:

Error: Key not valid for use in specified state.
Error:
Error: System.Security.Cryptography.CryptographicException
Error: at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
Error: at Octopus.Shared.Configuration.WindowsMachineKeyEncryptor.Decrypt(String encrypted)
Error: at Octopus.Shared.Configuration.FlatDictionaryKeyValueStore.Get[TData](String name, TData defaultValue, ProtectionLevel protectionLevel)
Error: at Octopus.Server.Commands.DatabaseCommand.Start()
Error: at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions)
Error: at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown)
Error: at Octopus.Shared.Startup.OctopusProgram.Run()
Error: -------------------------------------------------------------------------------
Error: Terminating process with exit code 100

I tried reinstalling with the latest version but get the same error above. This is the actual Octopus Deploy server (Server 2016) and I haven’t made any changes to it (other than MS updates)

A little more digging in the logs, here’s the error before the issue occured:

2018-10-25 10:43:19.8977 5600 10 ERROR An error occurred when checking for canceled tasks
System.Data.SqlClient.SqlException (0x80131904): SHUTDOWN is in progress.
Login failed for user ‘[domain\user]’.
Cannot continue the execution because the session is in the kill state.
A severe error occurred on the current command. The results, if any, should be discarded.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnection.BeginSqlTransaction(IsolationLevel iso, String transactionName, Boolean shouldReconnect)
at System.Data.SqlClient.SqlConnection.BeginTransaction(IsolationLevel iso, String transactionName)
at System.Data.SqlClient.SqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at Nevermore.RelationalTransaction…ctor(RelationalTransactionRegistry registry, RetriableOperation retriableOperation, IsolationLevel isolationLevel, ISqlCommandFactory sqlCommandFactory, JsonSerializerSettings jsonSerializerSettings, RelationalMappings mappings, IKeyAllocator keyAllocator, IRelatedDocumentStore relatedDocumentStore, String name)
at Nevermore.RelationalStore.BeginTransaction(RetriableOperation retriableOperation, String name)
at Octopus.Server.Orchestration.ServerTasks.RelationalTaskRunner.GetOwnedExecutingAndCancellingTasks()
at Octopus.Server.Orchestration.ServerTasks.RelationalTaskRunner.CheckForCancellationOrPause()
at Octopus.Server.Orchestration.ServerTasks.RelationalTaskRunner.RunCancellationCheck()
ClientConnectionId:f908afcb-3023-49e6-89f6-beacd5e80bb1
Error Number:6005,State:1,Class:14

Update: Fixed it by reinstalling to a different directory and moving the ‘packages’ from the old folder to the new ‘packages’ folder, then re-indexing. Hopefully thats all I need to deploy releases created from the old install

Hi Tony,

Thanks for updating here! I’m not sure why this has happened, though if you experience any further issues with your new installation, please let us know.

We do have some documentation pages which have information on moving your Octopus server but they are not entirely relevant here. We do suggest copying the Artifacts, Task Logs, and Packages directories.

Let me know if you have any questions. :slight_smile:

Best regards,
Daniel

1 Like