Problem
When integrating Terraform Enterprise (TFE) with GitHub Enterprise as described in the Configuring GitHub Enterprise Access documentation, the process may fail. The Terraform Enterprise UI displays a vague error message:
VCS webhook creation failure: <repo name>: 422 Unprocessable Entity
This error can be confusing, as standard troubleshooting steps like verifying network connectivity or administrative privileges do not resolve the issue.
Prerequisites
This issue is caused by a limitation within GitHub Enterprise. The limit of 250 webhooks for a single repository has been consistent from GitHub Enterprise Server version 3.4 through the current 3.11 release.
Cause
GitHub Enterprise enforces a limit of 250 webhooks per event for each repository. Once a repository reaches this limit for the push event, GitHub Enterprise prevents the creation of any new webhooks for that event, which TFE requires for integration.
If you attempt to manually create a webhook in the GitHub Enterprise UI after the limit is reached, a more descriptive error message appears:
Error:There was an error setting up your hook: The "push" event cannot have more than 250 hooks and Config must contain URL for webhooks.
Solution
To resolve this issue, you must reduce the number of existing webhooks on the affected GitHub Enterprise repository.
- Navigate to the repository settings in your GitHub Enterprise instance.
- Go to the Webhooks section.
- Identify and delete any hooks that are no longer needed to bring the total count below the 250 limit.
After cleaning up the unnecessary webhooks, you can retry the VCS provider configuration in Terraform Enterprise.