{"record":{"id":"c1996e4e94454f80","repo":"hashicorp/terraform","slug":"could-not-interpret-output-s-type-w","errorCode":null,"errorMessage":"could not interpret output %s type: %w","messagePattern":"could not interpret output (.+?) type: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/state.go","lineNumber":673,"sourceCode":"\n\t// We will only enable snapshots for intervals greater than zero\n\tlog.Printf(\"[TRACE] Intermediate state interval is set by header to %v\", s.stateSnapshotInterval)\n\ts.enableIntermediateSnapshots = s.stateSnapshotInterval > 0\n}\n\n// tfeOutputToCtyValue decodes a combination of TFE output value and detailed-type to create a\n// cty value that is suitable for use in terraform.\nfunc tfeOutputToCtyValue(output tfe.StateVersionOutput) (cty.Value, error) {\n\tvar result cty.Value\n\tbufType, err := json.Marshal(output.DetailedType)\n\tif err != nil {\n\t\treturn result, fmt.Errorf(\"could not marshal output %s type: %w\", output.ID, err)\n\t}\n\n\tvar ctype cty.Type\n\terr = ctype.UnmarshalJSON(bufType)\n\tif err != nil {\n\t\treturn result, fmt.Errorf(\"could not interpret output %s type: %w\", output.ID, err)\n\t}\n\n\tresult, err = gocty.ToCtyValue(output.Value, ctype)\n\tif err != nil {\n\t\treturn result, fmt.Errorf(\"could not interpret value %v as type %s for output %s: %w\", result, ctype.FriendlyName(), output.ID, err)\n\t}\n\n\treturn result, nil\n}\n","sourceCodeStart":655,"sourceCodeEnd":683,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/state.go#L655-L683","documentation":"After marshaling DetailedType to JSON, Terraform unmarshals it into a cty.Type via ctype.UnmarshalJSON. This fails when the detailed type does not conform to cty's type JSON schema.","triggerScenarios":"An output whose detailed-type JSON is malformed or uses a type kind cty does not recognize, e.g. state written by a newer Terraform emitting a type this version cannot parse.","commonSituations":"Version skew: reading state produced by a newer Terraform that introduced an unrecognized type kind.","solutions":["Upgrade Terraform to a version that supports the output's type.","Re-define the output with a simpler, broadly-supported type and re-apply.","If produced by a newer TF, export the state and re-import with a compatible version."],"exampleFix":"# before: TF X wrote an output type this TF cannot parse -> could not interpret output type\n# after: upgrade to a TF version that understands the type (or simplify the type)\nterraform version   # bump to a compatible release\nterraform refresh","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"outs, err := state.GetRootOutputValues(ctx)\nif err != nil && strings.Contains(err.Error(), \"could not interpret output\") && strings.Contains(err.Error(), \"type\") {\n    // likely version skew; upgrade TF or simplify the output type and re-apply\n}","preventionTips":["Read state only with a Terraform version compatible with how it was written","Simplify output types to broadly-supported kinds","Export/re-import state when downgrading versions"],"tags":["type","decoding","outputs","schema","version-skew"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}