I’ve just hit this exact issue, I gave the script you linked a shot but got a 500 error each time:
System.Net.SyncMemoryStream
{
"ErrorMessage": "Error converting value \"@{Octopus.ControlType=SingleLineText}\" to type 'System.Collections.Generic.IDictionary`2[System.String,System.String]'. Path 'Templates[0].DisplaySettings', line 25, position 85.", "FullException": "Newtonsoft.Json.JsonSerializationException: Error converting value \"@{Octopus.ControlType=SingleLineText}\" to type 'System.Collections.Generic.IDictionary`2[System.String,System.String]'. Path 'Templates[0].DisplaySettings', line 25, position 85. ---> System.ArgumentException: Could not cast or convert from System.String to System.Collections.Generic.IDictionary`2[System.String,System.String].
at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
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.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.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.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Octopus.Server.Web.Infrastructure.Api.Responder`1.Bind[TModel]() in Y:\\Work\\refs\\tags\\3.4.13\\source\\Octopus.Server\\Web\\Infrastructure\\Api\\Responder.cs:line 72
at Octopus.Server.Web.Infrastructure.Api.Responder`1.BindAndValidate[TModel]() in Y:\\Work\\refs\\tags\\3.4.13\\source\\Octopus.Server\\Web\\Infrastructure\\Api\\Responder.cs:line 77
at Octopus.Server.Web.Infrastructure.Api.ModifyResponseDescriptor`2.Responder.Execute() in Y:\\Work\\refs\\tags\\3.4.13\\source\\Octopus.Server\\Web\\Infrastructure\\Api\\ModifyResponseDescriptor.cs:line 42
at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Y:\\Work\\refs\\tags\\3.4.13\\source\\Octopus.Server\\Web\\Infrastructure\\Api\\Responder.cs:line 162
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass0_0.<.ctor>b__0(Object o) in Y:\\Work\\refs\\tags\\3.4.13\\source\\Octopus.Server\\Web\\Api\\OctopusRestApiModule.cs:line 46
at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)"
}
I ended up taking the steps you were completing in the script and doing them by hand in the Project table (really, really not recommended). After I finished the modification the project became usable again straight way with no ill effects.
I’m on Octopus 3.4.13 and I believe it happened because I was generating the version number from a project step and then removed that step, but that’s a guess. No other projects in our environment had this issue.