Exception when creating a new API key

Yesterday I upgraded Octopus Deploy from 1.6 to 2.6 to 3.0. It went relatively smoothly, however when I look at API keys, I notice it is missing. So I click “Create New API Key”, typed in “TeamCity Build”, then “Generate New”, and received this exception:

System.NullReferenceException: Object reference not set to an instance of an object.
at Octopus.Server.Web.Api.Actions.CreateApiKeyAction.Execute() in Y:\work\refs\heads\master\source\Octopus.Server\Web\Api\Actions\CreateApiKeyAction.cs:line 33
at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in Y:\work\refs\heads\master\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\heads\master\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)

Any help?

Hi Josh,

Sorry to hear that you are experiencing issues after your upgrade.

Could you please let me know what version of Octopus 3.0 you upgraded to?

Thank you and kind regards,
Henrik

3.0.17.2462

Hi Josh,

It looks like something could’ve possibly been missed in the migration, so could you run the below SQL script and send us the results please.

SELECT *
FROM [User]
WHERE [Username] = '{usernamethatgoterror}'

Thank you and warm regards,
Henrik

We had a bad user in the system with incomplete data. Removing this user solved the problem for other users attempting to get API keys.

Hi Josh,

Great to hear that you got this issue solved!

Happy deployments!
Henrik