Error cloning projects in v3.3.3

In v3.3.3 attempting to clone an existing project results in the following error being displayed in the UI:

System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Octopus.Server.Web.Api.Rules.ConfigurationWillBeCopiedFromCloneRule.AfterStore(Project model, ProjectResource resource, ISpecialRuleContext context) in Y:\work\refs\tags\3.3.3\source\Octopus.Server\Web\Api\Rules\ConfigurationWillBeCopiedFromCloneRule.cs:line 25
   at Octopus.Server.Web.Infrastructure.Api.Responder`1.ExecuteRules[TRule](Action`2 ruleCallback) in Y:\work\refs\tags\3.3.3\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 188
   at Octopus.Server.Web.Infrastructure.Api.CreateResponseDescriptor`2.Responder.Execute() in Y:\work\refs\tags\3.3.3\source\Octopus.Server\Web\Infrastructure\Api\CreateResponseDescriptor.cs:line 85
   at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Y:\work\refs\tags\3.3.3\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.3\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)

Screenshot attached.

Getting the same error using the NuGet client.

The nuget package

using C# code

        const string apikey = "API-HIDDEN";
        const string server = "http://delivery/OctopusDeploy/";

        var endpoint = new OctopusServerEndpoint(server, apikey);
        var client = new OctopusClient(endpoint);
        var repository = new OctopusRepository(client);
        var project = repository.Projects.FindByName("TestOnInternalSite");
        var newProject = new ProjectResource
         {
             Name = "MyClonedProject", 
             Description = "Cloned copy", 
             ProjectGroupId = project.ProjectGroupId, 
             LifecycleId = project.LifecycleId
         };
        client.Post("~/api/projects?clone=" + project.Id, newProject);
        /*
        Octopus Server returned an error: Value cannot be null.

Parameter name: key
Server exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at Octopus.Server.Web.Api.Rules.ConfigurationWillBeCopiedFromCloneRule.AfterStore(Project model, ProjectResource resource, ISpecialRuleContext context) in Y:\work\refs\tags\3.3.3\source\Octopus.Server\Web\Api\Rules\ConfigurationWillBeCopiedFromCloneRule.cs:line 25
at Octopus.Server.Web.Infrastructure.Api.Responder1.ExecuteRules[TRule](Action2 ruleCallback) in Y:\work\refs\tags\3.3.3\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 188
at Octopus.Server.Web.Infrastructure.Api.CreateResponseDescriptor2.Responder.Execute() in Y:\work\refs\tags\3.3.3\source\Octopus.Server\Web\Infrastructure\Api\CreateResponseDescriptor.cs:line 85 at Octopus.Server.Web.Infrastructure.Api.Responder1.Respond(TDescriptor options, NancyContext context) in Y:\work\refs\tags\3.3.3\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.3\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)

*/

Hi,

Thanks for getting in touch and sorry for the inconveniences caused by this issue.

I’ve created a github issue and notified the team about it: https://github.com/OctopusDeploy/Issues/issues/2437 . Keep in mind that all the devs are in Australia, so it might take until monday morning to get an update on it.

Regards,
Dalmiro

Hi Dalmiro,

I upgraded our servers to 3.3.3 to pick up your fix for https://github.com/OctopusDeploy/Issues/issues/2417, and after a couple of hours trying to figure out why my cloning stopped working, I’ve noticed this report.

I’m getting the same error: attempting to clone in 3.3.3 from PowerShell fails with:

Octopus Server returned an error: Value cannot be null.
Parameter name: key

Attempting to clone the same project in the Octopus UI gives the same error as in mattbrooks2010’s screenshot above.

The projects I’m trying to clone have Channels and variables scoped to those Channels. Let me know if you want more specifics.

I need to begin a large-scale clone of hundreds of projects on Tue29Mar, so this functionality is critical for us. Can you give us an estimated fix date for this issue?

Thanks!

Hi all,

A PR for a fix is already in and It’ll most likely by released on Monday morning after it gets reviewed.

We deeply apologize for the issues caused by this.

Regards,
Dalmiro

still getting an error when I tried to clone a project.

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

at System.Collections.Generic.List1..ctor(IEnumerable1 collection)

at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

at Octopus.Server.Web.Api.Rules.ConfigurationWillBeCopiedFromCloneRule.AfterStore(Project model, ProjectResource resource, ISpecialRuleContext context) in Y:\work\refs\tags\3.3.4\source\Octopus.Server\Web\Api\Rules\ConfigurationWillBeCopiedFromCloneRule.cs:line 44

at Octopus.Server.Web.Infrastructure.Api.Responder1.ExecuteRules[TRule](Action2 ruleCallback) in Y:\work\refs\tags\3.3.4\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 188

at Octopus.Server.Web.Infrastructure.Api.CreateResponseDescriptor`2.Responder.Execute() in Y:\work\refs\tags\3.3.4\source\Octopus.Server\Web\Infrastructure\Api\CreateResponseDescriptor.cs:line 85

at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Y:\work\refs\tags\3.3.4\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.4\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46

at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)

Hi Paul,

  • Did you upgrade to 3.3.4 where we shipped the fix?

  • Are you getting this from the Web UI? If that is the case, can you go to the Octopus folder in Program Files and double check the version of the DLL Octopus.Client.dll ?

  • Are you getting this using the Octopus.client? Can you also check the version of the same DLL?

Regards,
Dalmiro

we had the same issue with 3.3.3, but it does seem that 3.3.4 has resolved it. thanks.

  1. Yes we did upgrade to 3.3.4.
  2. we got the error from the web UI. The version of dll is 3.3.4.0.

It appears that we got the error on a particular project and not others. No sure why.

thanks,
Paul

Hi Paul,

I had your stack trace reviewed by the dev that submitted the fix in 3.3.4 (which seems to be working for @corey ). His strongest theory is that you might be trying to clone a project that is currently semi-corrupted because of this other issue: https://github.com/OctopusDeploy/Issues/issues/2417

They way to check this would be to go into your project’s variables and see if there’s a variable with a phantom channel as seen on the github issue’s screenshot. If you could send us the JSON of your project’s variable, we could check this for you. You can get that info by browsing

[OctopusURL]/api/variables/variableset-[Project ID]

for a project with the ID “Projects-1” the URL would be

[OctopusURL]/api/variables/variableset-Projects-1

If the JSON has sensitive info that you don’t want to share on this public thread, please send it to support(at)octopus(dot)com . We already have an NDA signed with Ezesoft, so I assume there’s no need to go through that again.

Best regards,
Dalmiro

Hi Dalmiro,

I can confirm that in our case upgrading from 3.3.3 to 3.3.4 has made cloning work again, and the clones I’ve created so far correctly carry across variable scoping by channel (i.e. https://github.com/OctopusDeploy/Issues/issues/2417 appears to be fixed).

Thanks for the quick turnaround.

Hi Dalmiro,

yep, the project seems to be corrupted. After we export and reimport from another server it, the clone works as expected.

thanks,
Paul

@martin - Thanks for the feedback!

@Paul - Glad to hear that.

Hello Dalmiro Grañas,

I have v 3.3.6 and I still can’t clone with an API

The 3.3.4 build worked for me. I have not tried the 3.3.6 build; yet.
Check to make sure you have update your Octopus.Client to the matching 3.3.6 version. And try again.
If that fails…
The forums have a few complaints with corrupted projects. I suggest make a new simple test project, with no steps. Try cloning the test project. If it works, probably something bad happened in a previous upgrade and corrupted the project.

A fix for corrupted project is to export/import the project back into the server. Take a look in the “Octopus Manager” comes with an Import/Export wizard. PLEASE TEST A SIMPLE PROJECT FIRST. This operation could be lossy.

Robert Livermore B.Sc. MCSD, MCSE+I, MCDBA
Software Developer
Cetaris
41 Constellation Court
Toronto, ON M9W 1K4
Office (416) 679-9555x2918
www.cetaris.comhttp://www.cetaris.com/

[cid:image001.gif@01C89FB1.12500140]

The information in this document is intended only for the parties specifically identified on this page and may contain confidential, proprietary and/or privileged material. Any unauthorized review, distribution or other use of or the taking of any action in reliance upon this information is prohibited. If you have received this document in error, please contact the author and delete or destroy all copies.

image001.gif

Just upgraded from 3.2.23 - 3.4.11

Also now getting the error below when trying to clone projects via the API:
Cannot find an overload for “post” and the argument count: “2”.

I tried creating a new project and cloning this so don’t think its due to a corrupted project. My Octopus.Client.dll is 3.5.3 Do I have the correct version?

Any help appreciated.

Thanks

Hi Conrad,

I’ve been using latest 3.5.x

Hope I do not confuse you with this answer.

Octopus deploy has a weekly cadence for the Server Build. This continues until today. The nuget octopus.client followed this pattern until version 3.4.6 (September 2016) They switch the nuget octopus.client versioning to follow the sematic version scheme. (If you follow NuGet recommendations, this is what you are supposed to do) If 3 digit changes Fix. If second digit changes then New non breaking feature. If fist digit changes breaking change. (read the release note to see if it affects you)

I just noticed a new 4.0.0 (October 24). Need to track down the release notes to see what the breaking change is.

Robert Livermore B.Sc. MCSD, MCSE+I, MCDBA
Software Developer
Cetaris
41 Constellation Court
Toronto, ON M9W 1K4
Office (416) 679-9555x2918
www.cetaris.comhttp://www.cetaris.com/

The information in this document is intended only for the parties specifically identified on this page and may contain confidential, proprietary and/or privileged material. Any unauthorized review, distribution or other use of or the taking of any action in reliance upon this information is prohibited. If you have received this document in error, please contact the author and delete or destroy all copies.