hashicorp/terraform · error
could not interpret output %s type: %w
Error message
could not interpret output %s type: %w
What it means
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.
Source
Thrown at internal/cloud/state.go:673
// We will only enable snapshots for intervals greater than zero
log.Printf("[TRACE] Intermediate state interval is set by header to %v", s.stateSnapshotInterval)
s.enableIntermediateSnapshots = s.stateSnapshotInterval > 0
}
// tfeOutputToCtyValue decodes a combination of TFE output value and detailed-type to create a
// cty value that is suitable for use in terraform.
func tfeOutputToCtyValue(output tfe.StateVersionOutput) (cty.Value, error) {
var result cty.Value
bufType, err := json.Marshal(output.DetailedType)
if err != nil {
return result, fmt.Errorf("could not marshal output %s type: %w", output.ID, err)
}
var ctype cty.Type
err = ctype.UnmarshalJSON(bufType)
if err != nil {
return result, fmt.Errorf("could not interpret output %s type: %w", output.ID, err)
}
result, err = gocty.ToCtyValue(output.Value, ctype)
if err != nil {
return result, fmt.Errorf("could not interpret value %v as type %s for output %s: %w", result, ctype.FriendlyName(), output.ID, err)
}
return result, nil
}
View on GitHub (pinned to c9def3e214)
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.
Example fix
# before: TF X wrote an output type this TF cannot parse -> could not interpret output type # after: upgrade to a TF version that understands the type (or simplify the type) terraform version # bump to a compatible release terraform refresh
Defensive patterns
Strategy: validation
Try / catch
outs, err := state.GetRootOutputValues(ctx)
if err != nil && strings.Contains(err.Error(), "could not interpret output") && strings.Contains(err.Error(), "type") {
// likely version skew; upgrade TF or simplify the output type and re-apply
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Version skew: reading state produced by a newer Terraform that introduced an unrecognized type kind.
Related errors
- could not decode output %s (ID %s)
- could not marshal output %s type: %w
- resource %s has an unsupported mode %s
- failed to decode backend config: %w
- Unknown type: %#v
AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07).
Data as JSON: /api/errors/c1996e4e94454f80.
Report an issue: GitHub.