hashicorp/terraform · critical
found unrecognized test status:
Error message
found unrecognized test status:
What it means
Internal panic in the cloud (TFC/E) test-result mapping: the TFE API returned a run.TestStatus value that has no case in the switch (Error/Fail/Pass/Pending/Skip). Because the default branch only panics, an unrecognized status string crashes the process. This indicates the API returned a new status value the client does not yet know about.
Source
Thrown at internal/cloud/test.go:317
}
// Otherwise the run has finished successfully, and we can look at the
// actual status of the test instead of the run to figure out what status we
// should return.
switch run.TestStatus {
case tfe.TestError:
return moduletest.Error, diags
case tfe.TestFail:
return moduletest.Fail, diags
case tfe.TestPass:
return moduletest.Pass, diags
case tfe.TestPending:
return moduletest.Pending, diags
case tfe.TestSkip:
return moduletest.Skip, diags
default:
panic("found unrecognized test status: " + run.TestStatus)
}
}
// discover the TFC/E API service URL
func discoverTfeURL(hostname svchost.Hostname, services *disco.Disco) (*url.URL, error) {
host, err := services.Discover(hostname)
if err != nil {
var serviceDiscoErr *disco.ErrServiceDiscoveryNetworkRequest
switch {
case errors.As(err, &serviceDiscoErr):
err = fmt.Errorf("a network issue prevented cloud configuration; %w", err)
return nil, err
default:
return nil, err
}
}
View on GitHub (pinned to d32a084675)
Solutions
- Upgrade the Terraform CLI to a version that recognises the new test status.
- Downgrade/align the TFC/E server version with the CLI.
- Report the unrecognized status string to the Terraform maintainers so the switch can be extended.
Example fix
// before (library code)
default:
panic("found unrecognized test status: " + run.TestStatus)
// after (defensive)
default:
return moduletest.Error, diags.Append(fmt.Errorf("unrecognized test status %q; upgrade terraform", run.TestStatus)) Defensive patterns
Strategy: try-catch
Try / catch
// Defensive version of the status switch
defer func() {
if r := recover(); r != nil {
status = moduletest.Error
diags = diags.Append(fmt.Errorf("recovered from unrecognized test status: %v", r))
}
}() Prevention
- Keep the Terraform CLI version aligned with or newer than the TFC/E server.
- Pin the TFE server version in CI to one the CLI supports.
- Watch release notes for new test-status values.
When it happens
Trigger: Polling test run results from TFC/E when the server sends a TestStatus string outside the known set (e.g. a newly introduced status like 'queued' or 'running' added in a newer TFE release).
Common situations: Terraform CLI version older than the TFC/E server which added a new test status, or running against a TFE instance with experimental features.
Related errors
- your version of Terraform Enterprise does not support key-va
- unsupported protocol version
- approved using the UI or API
- discarded using the UI or API
- operation timed out
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/c508c2eca02d5789.
Report an issue: GitHub.