Release channel belongs to the appropriate project

System integrity check is failing, and has been for some time. The error was occurring with version 3.4.12 to continues with 3.8.7
How can resolve this error

Task ID: ServerTasks-34537
Task status: Failed
Task queued: Saturday, February 18, 2017 7:12 AM
Task started: Saturday, February 18, 2017 7:12 AM
Task duration: less than a second
Server version: 3.8.7+Branch.master.Sha.1c86145a5304bc14527a2d08cc378c582c36d9bc

                | Failed: Check System Integrity

07:12:39 Info | Schema… [ Passed ]
07:12:39 Error | Release channel belongs to the appropriate project… [ Failed ]
07:12:39 Info | Orphaned channels… [ Passed ]
07:12:39 Info | Only one unfrozen deployment process per project… [ Passed ]
07:12:39 Fatal | One or more data errors were found.
|
| Running: Release channel belongs to the appropriate project
07:12:39 Error | Release Releases-1290 is in a channel that belongs to another project.

Hi,

That error is the result of a database-integrity-check process that runs in the background. It is informing us that somehow one of your Releases is associated with a Channel that belongs to another Project.

In the past there were a couple of bugs that could have caused this. We have scripts that run when you upgrade Octopus versions that should have, in theory, corrected this. Obviously it slipped through the nets somehow.

To resolve it, we will have to run some SQL against the database.

First step is to select which channel it should be associated with.
If you run:

SELECT * FROM [dbo].[Channel] 
WHERE ProjectId = (SELECT r.ProjectId FROM [dbo].[Release] r WHERE r.Id='Releases-1290')

You should see a list of channels. If there is only one, then grab it’s ID. If there are multiple, select which one you believe the Release should have (if it’s an ancient release, then possibly it doesn’t matter to you).

Then run (substituting the ChannelId you select above):

DECLARE @ChannelId nvarchar(50) = 'INSERT CHANNEL ID'

UPDATE [dbo].[Release] 
SET ChannelId=@ChannelId WHERE Id='Releases-1290'

Hopefully this will resolve the issue. Don’t hesitate to ask if we can provide any further support.

Regards,
Michael

That resolved the issue.
Thank You