I am using a build step within TeamCity to deploy a web application via Octopus. I’ve deployed this app many times (including a few times today). This afternoon I tried deploying it with a small verbiage change and got the following error in TeamCity:
Unable to create or deploy a release.
I looked into the build logs and saw this error: Error from Octopus server (HTTP 500): Octopus Server returned an error:
Error while executing SQL command: Violation of PRIMARY KEY constraint ‘PK_Deployment_Id’. Cannot insert duplicate key in object ‘dbo.Deployment’. The duplicate key value is (Deployments-3196).
The packages were successfully created in Octopus in the “Library” section with the appropriate package version numbers.
I also tried disabling the Octopus Deploy step in TeamCity and manually creating a release and deploying the application in Octopus and got a similar SQL error:
Error while executing SQL command: Violation of PRIMARY KEY constraint ‘PK_ServerTask_Id’. Cannot insert duplicate key in object ‘dbo.ServerTask’. The duplicate key value is (ServerTasks-27120). The statement has been terminated. The command being executed was: INSERT INTO dbo.[ServerTask] (Name, Description, QueueTime, StartTime, CompletedTime, ErrorMessage, ConcurrencyTag, State, HasPendingInterruptions, HasWarningsOrErrors, ServerNode, ProjectId, EnvironmentId, Id, Json) values (@Name, @Description, @QueueTime, @StartTime, @CompletedTime, @ErrorMessage, @ConcurrencyTag, @State, @HasPendingInterruptions, @HasWarningsOrErrors, @ServerNode, @ProjectId, @EnvironmentId, @Id, @Json)
TeamCity Enterprise version: 2017.1.2
Octopus version: 3.3.27
Any help with this issue would be greatly appreciated.