This error occurs in Terraform Enterprise/Cloud when the cost estimation service or Sentinel policy checker fails to enqueue jobs. Common causes include database schema issues after upgrades, network connectivity problems, or resource limitations.
The "Failed to enqueue cost estimate or Sentinel Policy check" error indicates that Terraform Enterprise or Terraform Cloud encountered a failure while attempting to queue either a cost estimation job or a policy evaluation job. This typically happens in Terraform Enterprise environments, particularly after version upgrades or infrastructure changes. The error suggests a backend service issue rather than a problem with your Terraform configuration. The cost estimation service and Sentinel policy worker are background services that process these requests asynchronously, and when they fail to queue, it usually indicates a database schema mismatch, network configuration issue, or service availability problem.
Verify your Terraform Enterprise version and check if you recently performed an upgrade, especially on a mounted disk instance. The issue affects v202212-x when upgrading from older versions.
# On your TFE instance, check version
curl http://localhost:8080/_health_check | grep -i versionIf you recently upgraded, this is likely the root cause and requires database schema recreation.
Create a support bundle from the Terraform Enterprise console (Settings > Diagnostics > Request support bundle) and examine the tfe-task-worker.stdout file.
Look for errors like:
error running database migrations
database driver: sql: Scan error on column index 0, name 'current_schema': converting NULL to string is unsupportedIf you see these database schema errors, the task_worker schema is missing and needs to be created.
Ensure the database service is healthy and all migrations have run.
# For mounted disk instances, restart the application
# This will trigger any pending migrations
sudo systemctl restart tfe
# Or, if using Docker Compose, restart services
docker-compose restartThe task_worker schema will be automatically created during application restart if it's missing.
If using Terraform Enterprise in Docker Compose, ensure the Sentinel worker network is configured correctly.
Check your docker-compose file for:
# Verify the network exists
docker network ls | grep tfe_terraform_isolation
# If missing, create it
docker network create tfe_terraform_isolation
# Or remove the TFE_RUN_PIPELINE_DOCKER_NETWORK setting to use default bridge
# Edit docker-compose and remove or comment out:
# - TFE_RUN_PIPELINE_DOCKER_NETWORK=tfe_terraform_isolationThen restart the services:
docker-compose down && docker-compose up -dCheck if the Sentinel policy worker service is running and accessible.
# Attempt to connect to Sentinel worker port
curl -v http://127.0.0.1:8000 2>&1 | head -20
# If connection refused, check if the service is running
docker ps | grep sentinel
ps aux | grep sentinelIf the service is not running, restart Terraform Enterprise or the worker containers. If you see "network tfe_terraform_isolation not found", follow Step 4 to fix the Docker network configuration.
If the issue continues after restarting the application and verifying database connectivity, contact HashiCorp Support with:
- Your support bundle (including tfe-task-worker.stdout)
- Terraform Enterprise version
- Deployment type (mounted disk, container, etc.)
- Recent infrastructure or configuration changes
HashiCorp Support can verify database schema creation and provide additional diagnostics.
The "Failed to enqueue" error can manifest differently depending on your deployment model:
Mounted Disk Instances: This is the most common scenario affecting upgraded TFE instances. The task_worker schema must exist in the database for cost estimation and Sentinel policy evaluation to function. After upgrades, ensure the database has been fully migrated by restarting the application.
Docker Compose Deployments: The Sentinel worker runs in a separate container and requires specific Docker networking. The error "Failed to open TCP connection to 127.0.0.1:8000" indicates the network is not properly configured. The TFE_RUN_PIPELINE_DOCKER_NETWORK setting must reference an existing network (or be removed to use the default bridge).
Troubleshooting Approach: Always start by generating a support bundle to inspect detailed logs. The database schema mismatch error is the most actionable—a simple restart typically fixes it. For networking issues, verify Docker networks are created before starting TFE.
Prevention: When upgrading Terraform Enterprise, plan for extended downtime and run a full application restart to ensure all database migrations complete.
Error: Error installing helm release: cannot re-use a name that is still in use
How to fix "release name in use" error in Terraform with Helm
Error: Error creating GKE Cluster: BadRequest
BadRequest error creating GKE cluster in Terraform
Error: External program failed to produce valid JSON
External program failed to produce valid JSON
Error: Unsupported argument in child module call
How to fix "Unsupported argument in child module call" in Terraform
Error: network is unreachable
How to fix "network is unreachable" in Terraform