Cannot delete deployment

When trying to delete a project on v3.3.12 that has been ported from a v2.6 version, I’m getting the following stack trace failure:

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: •. Path 'Variables[73].Name', line 1, position 13219.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r)
   at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader)
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader)
   at Newtonsoft.Json.Linq.JToken.ReadFrom(JsonReader reader)
   at Octopus.Core.RelationalStorage.VariableConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in Y:\work\refs\tags\3.3.12\source\Octopus.Core\RelationalStorage\VariableConverter.cs:line 62
   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.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 Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Octopus.Core.RelationalStorage.RelationalTransaction.<Stream>d__24`1.MoveNext() in Y:\work\refs\tags\3.3.12\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 253
   at Octopus.Core.Persistence.Indexes.DeletionDocumentUsageFinder.RelationshipBuilder`2.FindUsages(IRelationalTransaction transaction, Object from, List`1 referencingDocuments) in Y:\work\refs\tags\3.3.12\source\Octopus.Core\Persistence\Indexes\DeletionDocumentUsageFinder.cs:line 262
   at Octopus.Core.Persistence.Indexes.DeletionDocumentUsageFinder.FindReferences[TDocument](IRelationalTransaction transaction, TDocument document) in Y:\work\refs\tags\3.3.12\source\Octopus.Core\Persistence\Indexes\DeletionDocumentUsageFinder.cs:line 213
   at Octopus.Core.Persistence.Indexes.DeleteCommand.DeleteRecursive(IRelationalTransaction transaction, IDocument document, ReferenceCollection seenBefore) in Y:\work\refs\tags\3.3.12\source\Octopus.Core\Persistence\Indexes\DeleteCommand.cs:line 51
   at Octopus.Core.Persistence.Indexes.DeleteCommand.DeleteRecursive(IRelationalTransaction transaction, IDocument document, ReferenceCollection seenBefore) in Y:\work\refs\tags\3.3.12\source\Octopus.Core\Persistence\Indexes\DeleteCommand.cs:line 53
   at Octopus.Server.Web.Infrastructure.Api.DeleteOnBackgroundResponseDescriptor`2.Responder.Execute() in Y:\work\refs\tags\3.3.12\source\Octopus.Server\Web\Infrastructure\Api\DeleteOnBackgroundResponseDescriptor.cs:line 78
   at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Y:\work\refs\tags\3.3.12\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.3.12\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)

anyone care to take a guess as to what this may be?

Hi Richard,

Thanks for reaching out. Can you explain a bit more how did you port this from 2.6? Did you migrate just that project, or did you upgrade the entire 2.6 instance to 3.3.13?

Thanks,
Dalmiro

In this instance, the database was upgraded from a 2.6 instance to 3.x

This failing project and another have both been rebuilt, and I am trying to
remove this older project. The other one deleted without an issue.

Do we need to arrange a database backup for examination?

Hi,

I can see in the error message that JSON was unable to parse Variables[73].Name. We’ve had issue with brackets in names of things (Variables names and values, step names, etc), as JSON recognizes them as code instead of a raw value.

Do you recognize the value Variables[73].Name somewhere in your project configuration? If so, if you change the brackets to something else, you should be able to delete the project.

Let me know how that goes,
Dalmiro

No, I had honestly assumed the Variables[73].Name was coming from your
code. This is new to me.
I’ll review the code on our end just in case.

Sorry I admit I typed that in a totally confusing way. That Variables[73].Name definitely comes from our side, but its possible that the variable that is referencing in that loop over variables has a name with square brackets, double quotes or something else weird on the name.

I’d recommend reviewing the name of all the variables in that project and see if you can find a variable that has a non-alphabetic character, changing it and then trying to delete the project once again.

Hope its a bit clearer now :slight_smile: