Octopus failing to create release with exception

Our octopus instance started failing to create releases with below exception all of a sudden. Any clues as to why this might happen?

System.Exception: Error while executing SQL command: Cannot insert the value NULL into column ‘ChannelId’, table ‘OctopusEUS.dbo.Release’; column does not allow nulls. INSERT fails.
The statement has been terminated.
The command being executed was:
INSERT INTO dbo.[Release] (Version, Assembled, ProjectId, ProjectVariableSetSnapshotId, ProjectDeploymentProcessSnapshotId, Id, Json) values (@Version, @Assembled, @ProjectId, @ProjectVariableSetSnapshotId, @ProjectDeploymentProcessSnapshotId, @Id, @Json) —> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column ‘ChannelId’, table ‘OctopusEUS.dbo.Release’; column does not allow nulls. INSERT fails.
The statement has been terminated.

Hi,

Thanks for reaching out. Couple of troubleshooting questions:

  • Which version of Octopus are you running?
  • Which version were you running before that one?
  • Could you send us the JSON you get when browsing /api/projects/[Project ID]/channels ? Please keep in mind that [Project ID] is not the same as project name and should be in the format Projects-[Number]. If you are not sure about your project ID, browse /api/projects/all and look for the ID of that project. The full URL should look a bit like this: http://[OctopusURL]/api/projects/Projects-1/channels

Thanks,
Dalmiro

We were running 3.2.6

The issue went away after we upgrade to 3.3.4

Very strange though as the channels seems to have been introduced only in 3.2 and above

Thx,
Vidya

Hi Vidya,

Actually, between 3.2.6 and 3.3.4 we fixed a couple of issues regarding channels and their IDs, so it makes sense that it got fixed once you upgraded to the latest version.

Glad to hear you are back up and running :slight_smile:

Dalmiro

Hey guys, got this same exception after upgrading to 3.4.0-beta0001.

The stack trace as been attached, it also contains the channel json.

Error while executing SQL command: Cannot insert the value NULL into column ‘ChannelId’, table ‘OctopusDeploy.dbo.Deployment’; column does not allow nulls. INSERT fails.
The statement has been terminated.
The command being executed was:
INSERT INTO dbo.[Deployment] (Name, Created, EnvironmentId, ProjectId, ReleaseId, ProjectGroupId, TaskId, TenantId, DeployedBy, DeployedToMachineIds, Id, Json) values (@Name, @Created, @EnvironmentId, @ProjectId, @ReleaseId, @ProjectGroupId, @TaskId, @TenantId, @DeployedBy, @DeployedToMachineIds, @Id, @Json)

Exception1.txt (5 KB)

Looking a bit deeper it looks as though perhaps the database wasn’t updated properly.

I see this in the “Check System Integrity” area.

Unexpected item: IDX dbo.IX_Deployment_ChannelId ChannelId
Unexpected item: IDX dbo.IX_Deployment_ChannelId NONCLUSTERED 0
Unexpected item: USER_TABLE dbo.Deployment.ChannelId nvarchar(100/0/0) 0
Unexpected item: VIEW sys.database_firewall_rules.create_date datetime(8/23/3) 0
Unexpected item: VIEW sys.database_firewall_rules.end_ip_address varchar(45/0/0) 0
Unexpected item: VIEW sys.database_firewall_rules.id int(4/10/0) 0
Unexpected item: VIEW sys.database_firewall_rules.modify_date datetime(8/23/3) 0
Unexpected item: VIEW sys.database_firewall_rules.name sysname(256/0/0) 0
Unexpected item: VIEW sys.database_firewall_rules.start_ip_address varchar(45/0/0) 0

I know I can ignore the firewall rules errors (azure sql db) but the first three seem to be wrong.

Hi Ben,

We introduced a fix for this in 3.3.22, but since 3.4.0-beta0001 was released before that version, the fix wasn’t merged on it. It will be for sure in the next beta.

In the meantime, you can run the below script to make the same changes that were introduced in 3.3.22 to fix this. It was made so there’s not problem to run it more than once, so you won’t have a problem when you install the next beta (which will contain the same fix).

Let me know how it goes,
Dalmiro