{"record":{"id":"c508c2eca02d5789","repo":"hashicorp/terraform","slug":"found-unrecognized-test-status","errorCode":null,"errorMessage":"found unrecognized test status: ","messagePattern":"found unrecognized test status: ","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/cloud/test.go","lineNumber":317,"sourceCode":"\t}\n\n\t// Otherwise the run has finished successfully, and we can look at the\n\t// actual status of the test instead of the run to figure out what status we\n\t// should return.\n\n\tswitch run.TestStatus {\n\tcase tfe.TestError:\n\t\treturn moduletest.Error, diags\n\tcase tfe.TestFail:\n\t\treturn moduletest.Fail, diags\n\tcase tfe.TestPass:\n\t\treturn moduletest.Pass, diags\n\tcase tfe.TestPending:\n\t\treturn moduletest.Pending, diags\n\tcase tfe.TestSkip:\n\t\treturn moduletest.Skip, diags\n\tdefault:\n\t\tpanic(\"found unrecognized test status: \" + run.TestStatus)\n\t}\n}\n\n// discover the TFC/E API service URL\nfunc discoverTfeURL(hostname svchost.Hostname, services *disco.Disco) (*url.URL, error) {\n\thost, err := services.Discover(hostname)\n\tif err != nil {\n\t\tvar serviceDiscoErr *disco.ErrServiceDiscoveryNetworkRequest\n\n\t\tswitch {\n\t\tcase errors.As(err, &serviceDiscoErr):\n\t\t\terr = fmt.Errorf(\"a network issue prevented cloud configuration; %w\", err)\n\t\t\treturn nil, err\n\t\tdefault:\n\t\t\treturn nil, err\n\t\t}\n\t}\n","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/test.go#L299-L335","documentation":"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.","triggerScenarios":"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).","commonSituations":"Terraform CLI version older than the TFC/E server which added a new test status, or running against a TFE instance with experimental features.","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."],"exampleFix":"// before (library code)\ndefault:\n    panic(\"found unrecognized test status: \" + run.TestStatus)\n\n// after (defensive)\ndefault:\n    return moduletest.Error, diags.Append(fmt.Errorf(\"unrecognized test status %q; upgrade terraform\", run.TestStatus))","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Defensive version of the status switch\ndefer func() {\n    if r := recover(); r != nil {\n        status = moduletest.Error\n        diags = diags.Append(fmt.Errorf(\"recovered from unrecognized test status: %v\", r))\n    }\n}()","preventionTips":["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."],"tags":["terraform","cloud","tfe","test-status","panic","version-mismatch"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}