The resource 'xxx' was not found

Hello there,
one from our developer report very weird issue in Octopus. After some modifications of deployment process, error occurred during save operation.

Unhandled error on request: PUT http://octopus.app/api/Spaces-1/projects/Projects-xxx/deploymentprocesses 80001d1d-0000-dc00-b63f-84710c7967bb by SOMEONE : Sequence contains no matching element System.InvalidOperationException: Sequence contains no matching element

Now, project overview page renders with error message, like in screen below.


It looks like inconsistent transaction on database, but It hard to say whats go wrong. Could you help us to bring this project back to normal ?

Our Octopus server version is: 2021.2 (Build 7580)

Best regards,
Piotr

Hi Piotr,

Thanks for posting your question, and I’m sorry to hear you’ve hit that error when saving.

I’m not quite sure what’s causing this, but I was wondering if you be willing to send through the raw JSON from the endpoint shown in the error: http://octopus.app/api/Spaces-1/projects/Projects-xxx/deploymentprocesses

You should be able to copy the JSON from API endpoint in the browser and save it into a text or JSON file.

Also, are there any step templates from your Library associated with this process? If so, could you get a copy of this from Library > Step Templates > (your template) > Overflow menu (3 dots) > Export:
image

Lastly, can you also provide me with a server log from around the time the save was performed?

Once you have all of that, you can send the files securely to me via this link, and I’ll take a look at it. We’ll continue troubleshooting from there!

Regards,
Patrick

Hi @patrick.smergut,
thank you for your quick response and sorry for ma late,

I’m not quite sure what’s causing this, but I was wondering if you be willing to send through the raw JSON from the endpoint shown in the error: http://octopus.app/api/Spaces-1/projects/Projects-xxx/deploymentprocesses

I’m not to able to get this raw JSON, because It was generated by Octopus. Nothing from external sources was send.

Also, are there any step templates from your Library associated with this process? If so, could you get a copy of this from Library > Step Templates > (your template) > Overflow menu (3 dots) > Export

I try to get this logs and send It privately. I also suggest to change a way, how currently logs are aggregated. Personal data(name and surname) shouldn’t be log there - just unique database ID. I need to sanitize this values myself.

Also I provide more details:

  • Project overview is unreachable after removing Standard Deployment step from Deployment Process. Developer also have a chance to change general settings - changing Multi-tenant Deployments options from Allow deployments with or without a tenant to Require a tenant for all deployments. After that actions We cannot load even main deployment process page.

  • In web browser console url call to https://octopus.app/api/Spaces-1/projects/Projects-961 ends with 404 status and message “ErrorMessage”: “The resource ‘Standard Deployment’ was not found.”

  • Error is related with Projects-961 project

Hi Piotr,

We’ve seen some similar issues appear recently when steps that are being used as part of the versioning strategy are renamed or removed. This results in the step being unable to be found and the project becoming unavailable.

Essentially, the deployment settings of the project have likely become invalid. We do have a script that has been successful in resolving this issue previously.

The script’s purpose is to create a new, temporary project for new deployment settings, modify the deployment settings to match the broken project and then PUT them over the top of the broken deployment settings and delete the temporary project.

It should correct the reference to the missing resource; all you’d have to do afterwards is modify the versioning strategy/release creation back to how you’d like it.

I’ll attach it in-line to avoid any e-mail filtering.

To use the script, replace the following variables with values that match your instance, along with the usual API key and Octopus URL:

$spaceId (The space ID of the broken Project - in this case Spaces-1 )
$projectGroupName (Any currently existing project group that exists in Spaces-1 )
$lifecycleName (Default Lifecycle name for Spaces-1 )
$brokenProjectId (The Projects-ID of the broken Project - in this case Projects-281 )

# Create Script Variables
$octopusUrl = "https://OctopusURL"
$octopusAPIKey = "API-XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
$header = @{ "X-Octopus-ApiKey" = $octopusAPIKey }

# Case Specific Variables | Customise Lifecycle Name and Project Group if necessary.
$spaceId = "Spaces-1"
$newProjectName = "Project_For_Template"
$newProjectDescription = "Project created for version template to fix broken references. Will be deleted after."
$projectGroupName = "Default Project Group"
$lifecycleName = "Default lifecycle"

# BROKEN PROJECT ID
$brokenProjectId = "Projects-XX"

# Get Project Group Id
$projectGroup = (Invoke-RestMethod -Method Get "$octopusURL/api/$($spaceId)/projectgroups/all" -Headers $header) | Where-Object {$_.Name -eq $projectGroupName}

# Get Lifecycle Id
$lifeCycle = (Invoke-RestMethod -Method Get "$octopusURL/api/$($spaceId)/lifecycles/all" -Headers $header) | Where-Object {$_.Name -eq $lifecycleName}

# JSON Payload for template project
$jsonPayload = @{
Name = $newProjectName
ProjectGroupId = $projectGroup.Id
LifeCycleId = $lifeCycle.Id
}

# Create new project
$newProject = Invoke-RestMethod -Method Post -Uri "$octopusURL/api/$($spaceId)/projects" -Body ($jsonPayload | ConvertTo-Json -Depth 10) -Headers $header

# Gather deployment settings template
$depTemplate = Invoke-RestMethod -Method Get -Uri "$octopusURL$($newProject.Links.DeploymentSettings)" -Headers $header

# Copy and modify template to match broken project
$newDepSettings = $depTemplate
$newDepSettings.Id = $newDepSettings.Id.replace($newProject.Id, $brokenProjectId)
$newDepSettings.ProjectId = $newDepSettings.ProjectId.replace($newProject.Id, $brokenProjectId)

# Determine deployment settings URL for broken project
$newUrl = $newProject.Links.DeploymentSettings.replace($newProject.Id, $brokenProjectId)

# Upload newly created default deployment settings to broken project
Invoke-RestMethod -Method Put -Uri "$octopusURL$($newUrl)" -Headers $header -Body ($newDepSettings | ConvertTo-Json -Depth 10)

# Delete Template Project
Invoke-RestMethod -Method Delete -Uri "$octopusURL/api/$($spaceId)/projects/$($newProject.Id)" -Headers $header

Regards,
Paul

1 Like

Hi @paul.calvert,
thanks for response.

I’m very happy to announce that the project is back normal and is ready for deployments.

Thanks for you support and patience.
Piotr

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.