Unable to upgrade past 3.1.0-beta2

We were running 3.1.0 beta 1 and attempted to upgrade to 3.2.0 beta 1. The service failed to stay up. The octopus server log contains the following SQL warning and JSON serialization error:

2015-10-29 13:17:24.5804     66  INFO  Stopping the Windows Service
2015-10-29 13:17:24.5804     66  INFO  The Octopus server is shutting down...
2015-10-29 13:17:24.5961     66  INFO  Shutting down the embedded web server
2015-10-29 13:17:24.6277     66  INFO  listen://0.0.0.0:10943/          66  Listener stopped
2015-10-29 13:17:24.6277     66  INFO  The Windows Service has stopped
2015-10-29 13:18:11.3838      7  INFO  Browse your Octopus server at: http://localhost:8080/
2015-10-29 13:18:11.3838      7  INFO  Browse your Octopus server at: http://localhost:8080/
2015-10-29 13:18:11.3838      7  INFO  The Octopus server is starting: Initializing database and performing migrations...
2015-10-29 13:18:12.1821      7  INFO  Beginning database upgrade
2015-10-29 13:18:12.1821      7  INFO  Fetching list of already executed scripts.
2015-10-29 13:18:12.4808      7  INFO  Executing SQL Server script 'Octopus.Core.UpgradeScripts.Script0020 - Create mutex table.sql'
2015-10-29 13:18:12.8629      7  INFO  Warning! The maximum key length for a clustered index is 900 bytes. The index 'PK_Mutex_Id' has maximum length of 1000 bytes. For some combination of large values, the insert/update operation will fail.
2015-10-29 13:18:12.8919      7  INFO  Executing SQL Server script 'Octopus.Core.UpgradeScripts.Script0021 - Create Channels.sql'
2015-10-29 13:18:13.3228      7  INFO  |     |
2015-10-29 13:18:13.3228      7  INFO  |   9 |
2015-10-29 13:18:13.9207      7  INFO  Executing SQL Server script 'Octopus.Core.UpgradeScripts.Script0022 - Add channel id to IdsInUse.sql'
2015-10-29 13:18:14.1976      7  INFO  Executing SQL Server script 'Octopus.Core.UpgradeScripts.Script0024 - Created Release_LatestByProjectChannel view.sql'
2015-10-29 13:18:14.8100      7  INFO  Upgrade successful
2015-10-29 13:18:15.8825      7 FATAL  Error converting value "OctopusServerNodeView" to type 'Octopus.Client.Model.Permission'. Path 'GrantedPermissions[72]', line 1, position 1348.
Newtonsoft.Json.JsonSerializationException: Error converting value "OctopusServerNodeView" to type 'Octopus.Client.Model.Permission'. Path 'GrantedPermissions[72]', line 1, position 1348. ---> System.ArgumentException: Requested value 'OctopusServerNodeView' was not found.
   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnumName(String enumText, Boolean isNullable, Type t)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Octopus.Core.RelationalStorage.RelationalTransaction.<Stream>d__23`1.MoveNext() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 251
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Octopus.Core.Initialization.BuiltIn.BuiltInTeamInitializer.EnsureRoleExists(IRelationalTransaction transaction, BuiltInRole builtInRole) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\BuiltIn\BuiltInTeamInitializer.cs:line 121
   at Octopus.Core.Initialization.BuiltIn.BuiltInTeamInitializer.EnsureBuiltInRolesExist(IRelationalTransaction transaction) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\BuiltIn\BuiltInTeamInitializer.cs:line 113
   at Octopus.Core.Initialization.BuiltIn.BuiltInTeamInitializer.Initialize(IRelationalStore store) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\BuiltIn\BuiltInTeamInitializer.cs:line 27
   at Octopus.Core.Initialization.StoreInitializer.Initialize() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\StoreInitializer.cs:line 22
   at Octopus.Server.OctopusServerEngine.Start() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Server\OctopusServerEngine.cs:line 49
   at Octopus.Server.Commands.RunCommand.Start() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Server\Commands\RunCommand.cs:line 37
   at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Shared\Startup\AbstractCommand.cs:line 57
   at Octopus.Shared.Startup.WindowsServiceHost.<>c__DisplayClass1_0.<Run>b__0() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Shared\Startup\WindowsServiceHost.cs:line 19
   at Octopus.Shared.Startup.WindowsServiceAdapter.RunService() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Shared\Startup\WindowsServiceAdapter.cs:line 44
2015-10-29 13:18:15.9535      7 FATAL  Unhandled AppDomain exception occurred: Error converting value "OctopusServerNodeView" to type 'Octopus.Client.Model.Permission'. Path 'GrantedPermissions[72]', line 1, position 1348.
Newtonsoft.Json.JsonSerializationException: Error converting value "OctopusServerNodeView" to type 'Octopus.Client.Model.Permission'. Path 'GrantedPermissions[72]', line 1, position 1348. ---> System.ArgumentException: Requested value 'OctopusServerNodeView' was not found.
   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnumName(String enumText, Boolean isNullable, Type t)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Octopus.Core.RelationalStorage.RelationalTransaction.<Stream>d__23`1.MoveNext() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 251
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Octopus.Core.Initialization.BuiltIn.BuiltInTeamInitializer.EnsureRoleExists(IRelationalTransaction transaction, BuiltInRole builtInRole) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\BuiltIn\BuiltInTeamInitializer.cs:line 121
   at Octopus.Core.Initialization.BuiltIn.BuiltInTeamInitializer.EnsureBuiltInRolesExist(IRelationalTransaction transaction) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\BuiltIn\BuiltInTeamInitializer.cs:line 113
   at Octopus.Core.Initialization.BuiltIn.BuiltInTeamInitializer.Initialize(IRelationalStore store) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\BuiltIn\BuiltInTeamInitializer.cs:line 27
   at Octopus.Core.Initialization.StoreInitializer.Initialize() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Core\Initialization\StoreInitializer.cs:line 22
   at Octopus.Server.OctopusServerEngine.Start() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Server\OctopusServerEngine.cs:line 49
   at Octopus.Server.Commands.RunCommand.Start() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Server\Commands\RunCommand.cs:line 37
   at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Shared\Startup\AbstractCommand.cs:line 57
   at Octopus.Shared.Startup.WindowsServiceHost.<>c__DisplayClass1_0.<Run>b__0() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Shared\Startup\WindowsServiceHost.cs:line 19
   at Octopus.Shared.Startup.WindowsServiceAdapter.RunService() in Y:\work\refs\tags\3.2.0-beta.1\source\Octopus.Shared\Startup\WindowsServiceAdapter.cs:line 59
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Happy to provide more details if that is helpful.

Thanks,

David

Update:

I was able to successfully reinstall and run 3.1.0-beta1. I then attempted to upgrade to 3.1.5. I got the same JsonSerializationException from above. I then rolled back to 3.1.0-beta1 and attempted to upgrade to 3.1.0-beta2 which worked fine. I then attempted to upgrade to 3.1.0 and received the JsonSerializationException.

So it appears that I am unable to upgrade past the latest beta release of 3.1.0 and this issue is not specifically related to 3.2.0-beta-*.

Hi David,

Sorry you are running into this issue, there was a permission in the 3.1 beta that didn’t make it to release.

You can update past 3.1 beta by removing the roles from your database. Look at the System Administrator role in the UserRoles table and remove the OctopusServerNodeView and OctopusServerNodeEdit permissions. They will be somewhere in the JSON.

Cheers
Shane

Hey Shane,

That worked. Thanks for the help.

David