Problem
When you attempt to create a new version control system (VCS) driven workspace in HCP Terraform or Terraform Enterprise, the operation fails with a 422 Unprocessable Entity error.
{
"errors": [
{
"status": "400",
"title": "bad request",
"detail": "Failed to create webhook on repository: Failed to create webhook on repository: ORG/REPO_NAME: 422 Unprocessable Entity"
}
]
}Cause
If you use GitHub or GitHub Enterprise as your VCS provider, this error can occur due to a GitHub limitation that allows a maximum of 20 webhooks per repository.
Solution
To resolve this issue, you must inspect and reduce the number of webhooks configured for the target repository.
- Navigate to your repository's webhook settings page. The URL follows this pattern:
https://github.com/ORG_NAME/REPO_NAME/settings/hooks - Verify that fewer than 20 webhooks are configured for the repository. If the repository already has 20 webhooks, you must delete at least one before proceeding.
- After ensuring the repository has fewer than 20 webhooks, attempt to create the workspace again in HCP Terraform or Terraform Enterprise.
Additional Information
For more details on this limitation, refer to the GitHub documentation about webhooks.