Unable to clone project

modelling

#1

Hello,

I found multiple topics about this issue but all for version 3.x. I’m actually facing this problem in version 2018.8.4.

I select the project I want to clone, go to Settings -> Clone, I fill the new project name and click Save.

I get this error in a red message : Value cannot be null. Parameter name: key

And this response in browser console :

{
  "ErrorMessage": "Value cannot be null.\r\nParameter name: key",
  "FullException": "Value cannot be null.\r\nParameter name: key\r\nSystem.ArgumentNullException\r\n   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)\r\n   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)\r\n   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n   at Octopus.Server.Web.Api.Rules.ConfigurationWillBeCopiedFromCloneRule.MapChannelIdOnTrigger(ProjectTrigger trigger, IDictionary`2 channelIdMap)\r\n   at Octopus.Server.Web.Api.Rules.ConfigurationWillBeCopiedFromCloneRule.CloneProjectTriggers(String originalProjectId, String clonedProjectId, IDictionary`2 channelIdMap)\r\n   at Octopus.Server.Web.Api.Rules.ConfigurationWillBeCopiedFromCloneRule.AfterStore(Project model, ProjectResource resource, ISpecialRuleContext context)\r\n   at Octopus.Server.Web.Infrastructure.Api.Responder`1.ExecuteRegisteredRules[TRule](Action`2 ruleCallback)\r\n   at Octopus.Server.Web.Infrastructure.Api.CreateResponseDescriptor`2.Responder.ExecuteRegistered()\r\n   at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context)\r\n   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n   at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.b__1(Object x)\r\n   at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)"
} 

Here some details about the request :
Request URL:
https://<url>/api/projects?clone=Projects-21

Request payload:
{"Id":null,"VariableSetId":null,"DeploymentProcessId":null,"DiscreteChannelRelease":false,"IncludedLibraryVariableSetIds":null,"DefaultToSkipIfAlreadyInstalled":false,"TenantedDeploymentMode":"Untenanted","VersioningStrategy":{"Template":"#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}"},"ReleaseCreationStrategy":null,"Templates":[],"AutoDeployReleaseOverrides":[],"Name":"New-project-name-containing-dashes","Slug":null,"Description":"","IsDisabled":false,"ProjectGroupId":"ProjectGroups-21","LifecycleId":"Lifecycles-1","AutoCreateRelease":false,"DefaultGuidedFailureMode":"EnvironmentDefault","ProjectConnectivityPolicy":{"SkipMachineBehavior":"None","TargetRoles":[],"AllowDeploymentsToNoTargets":false},"logo":null,"ClonedFromProjectId":null,"Links":null}

Thank you for your help.


(Kenneth Bates) #3

Hi Kevin,

Thanks for getting in touch! I’m terribly sorry you’re hitting this unexpected behavior. I’m unable to replicate this issue, however, so I suspect it could be due to some inconsistent data. Are you able to save any general changes to the project at all? Could you provide an export of this project to allow us to look into what could be causing this? The following doc page outlines how you can export a single project via Octo.exe export command.

Alternatively you can use the partial-export command using the Octopus.Migrator.exe as shown in the following doc page.

I look forward to hearing back and getting to the bottom of this one!

Best regards,

Kenny


#4

Hi Kenny,

Thank you for your answer. Unfortunately, It would require a long approval process for me to be allowed to export any sensitive data from the system, sorry about that.

So I thought to disable or delete some elements in the project to see if I would be able to clone it… and bingo, the first thing I tried worked !

For your information, it was a daily trigger which deploys from development to staging. I deleted it (not disabled it).

Here is the trigger export :


{
  "$type": "Octopus.Core.Model.Projects.ProjectTrigger.ProjectTrigger, Octopus.Core",
  "Id": "ProjectTriggers-1",
  "Name": "Daily DEV to STAGING",
  "ProjectId": "Projects-21",
  "IsDisabled": false,
  "TriggerType": "Scheduled",
  "Filter": {
    "$type": "Octopus.Core.Model.Projects.ProjectTrigger.ScheduledTriggerFilters.DailyScheduledTriggerFilter, Octopus.Core",
    "StartTime": "2018-08-30T18:00:00Z",
    "RunType": "ScheduledTime",
    "Interval": "OnceDaily",
    "HourInterval": null,
    "MinuteInterval": null,
    "Timezone": "W. Europe Standard Time",
    "CronExpression": "0 0 18 * * *",
    "NextScheduledRun": "2018-09-17T16:00:00"
  },
  "Action": {
    "$type": "Octopus.Core.Model.Projects.ProjectTrigger.DeployLatestReleaseAction, Octopus.Core",
    "Variables": null,
    "SourceEnvironmentId": "Environments-1",
    "DestinationEnvironmentId": "Environments-2",
    "ChannelId": null,
    "TenantIds": [
      "Tenants-21"
    ],
    "TenantTags": []
  }
}

I hope this helps !

Thank you for your support and have a great day.
Kevin


(Kenneth Bates) #5

Hi Kevin,

Thanks for following up. That’s great to hear you’ve been able to fix this issue! I’ve actually been able to reproduce this bug based on your findings - thank you for letting us know! I’ve raised an issue to get this resolved, and you can track its progress here.

Let me know if we can assist in anything else. :slight_smile:

Best regards,

Kenny