{"record":{"id":"002c9a50cb092f70","repo":"hashicorp/terraform","slug":"could-not-decode-output-s-id-s","errorCode":null,"errorMessage":"could not decode output %s (ID %s)","messagePattern":"could not decode output (.+?) \\(ID (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/state.go","lineNumber":612,"sourceCode":"\t\t\t\treturn nil, ErrStateVersionUnauthorizedUpgradeState\n\t\t\t}\n\n\t\t\treturn state.RootOutputValues, nil\n\t\t}\n\n\t\tif output.Sensitive {\n\t\t\t// Since this is a sensitive value, the output must be requested explicitly in order to\n\t\t\t// read its value, which is assumed to be present by callers\n\t\t\tsensitiveOutput, err := s.tfeClient.StateVersionOutputs.Read(ctx, output.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"could not read state version output %s: %w\", output.ID, err)\n\t\t\t}\n\t\t\toutput.Value = sensitiveOutput.Value\n\t\t}\n\n\t\tcval, err := tfeOutputToCtyValue(*output)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not decode output %s (ID %s)\", output.Name, output.ID)\n\t\t}\n\n\t\tresult[output.Name] = &states.OutputValue{\n\t\t\tValue:     cval,\n\t\t\tSensitive: output.Sensitive,\n\t\t}\n\t}\n\n\treturn result, nil\n}\n\nfunc clamp(val, min, max int64) int64 {\n\tif val < min {\n\t\treturn min\n\t} else if val > max {\n\t\treturn max\n\t}\n\treturn val","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/state.go#L594-L630","documentation":"After fetching each output, Terraform converts it to a cty.Value via tfeOutputToCtyValue. This error means that conversion failed for a specific named output. Note the underlying cause is not wrapped into the message, so detail is lost.","triggerScenarios":"An output whose DetailedType/Value cannot be converted to a cty value: corrupted or unsupported type information, or a value/type mismatch in the stored state.","commonSituations":"State written by a future/incompatible Terraform version, or a corrupted output entry (e.g. from manual state edits).","solutions":["Identify the named output and inspect its stored type and value.","Re-write the state by re-applying with a compatible Terraform version.","Remove or redefine the offending output and re-apply.","Upgrade or downgrade Terraform to the version that wrote the state."],"exampleFix":"# before: output stored with an incompatible/corrupt type -> could not decode output <name>\n# after: redefine the output cleanly and re-apply to rewrite state\noutput \"thing\" { value = var.thing }   # plain, supported type\nterraform apply","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"outs, err := state.GetRootOutputValues(ctx)\nif err != nil && strings.Contains(err.Error(), \"could not decode output\") {\n    // identify the named output, inspect its type/value, redefine and re-apply\n}","preventionTips":["Use compatible Terraform versions for a given state","Avoid manual state edits","Redefine corrupted outputs and re-apply to rewrite state"],"tags":["outputs","decoding","type-conversion","corruption"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}