Deleting a Spacelift stack whose linked repository no longer exists

Last updated: September 4, 2026

If you try to delete a Spacelift stack whose linked VCS repository has already been deleted or is no longer accessible, you may encounter an error similar to the following:

could not start resource destruction for this stack - its source code could not be retrieved from the "test/my-repo" repository on GitHub (for example, the repository may have been deleted or is no longer accessible). To delete the stack without destroying its resources, choose "Keep resources" and try again.

Why does this happen?

When you delete a stack and choose the Delete resources option, Spacelift kicks off a destroy run behind the scenes. That run needs to check out your Infrastructure-as-Code from the linked repository in order to know how to tear down the resources. If the repository no longer exists, there is nothing to check out, and the deletion fails.

How to delete the stack

You have two options depending on whether you want to destroy the cloud resources or keep them:

Option 1: Keep resources (recommended when the repository is gone)

Choose the Keep resources option when deleting the stack. Spacelift will remove the stack without attempting a destroy run, so no repository access is needed. You will then need to clean up any leftover infrastructure yourself — either directly in your cloud provider, or by pointing a new stack at a repository that still contains the original code and running a destroy from there.

Option 2: Restore repository access first

If you want Spacelift to destroy the stack, you must first restore access to a valid repository. You can do this by temporarily pointing the stack to a valid VCS repository and branch, then proceeding with the Delete resources deletion. Please note that any active resources created by this stack will not be automatically deleted, and they will will keep running unmanaged until you delete them.

Removing "Protect from Deletion" when the repository is missing

Spacelift validates the VCS source before saving any stack changes, including toggling the Protect from Deletion flag. If the linked repository no longer exists, this validation will fail and you won't be able to unprotect the stack directly.

The workaround is to temporarily point the stack to a valid repository and branch, toggle off Protect from deletion in Stack Settings → Behavior (if it's enabled), and then proceed with deletion.