Why am I getting "GitHub app is not installed to namespace" error when creating Spacelift stacks?

Last updated: September 9, 2025

Context

When creating Spacelift stacks using Terraform and a GitHub Enterprise integration, you may encounter an error message stating "custom GitHub app is not installed to namespace" even though the GitHub app appears to be properly installed in your organization.

Answer

This error typically occurs when the GitHub Enterprise integration ID is not properly specified in your Terraform configuration. To resolve this issue:

  1. Verify that your GitHub app is installed and has access to the required repositories in your organization

  2. In your Terraform configuration for the Spacelift stack, ensure you include the correct GitHub Enterprise block with both the namespace and ID parameters:

    github_enterprise {
      id = "your-github-app-id"
      namespace = "your-org-name"
    }
    

Important: The `id` parameter in the github_enterprise block is required to specify which GitHub Enterprise integration to use. If not specified, Spacelift will attempt to use the default integration, which may cause the error.

Example configuration:

resource "spacelift_stack" "example" {
  name = "example-stack"
  space_id = "example-space"

  github_enterprise {
    id = "my-github-app"
    namespace = "MyOrg"
  }
  repository = "my-repository"
  branch = "main"
  # ... other configuration options
}

Troubleshooting

To easily troubleshoot this, you can manually create a stack using the desired repository in the UI and select the "as Terraform code" option to view the correct configuration.