hashicorp/terraform · error

couldn't read plan data for cloud run

Error message

couldn't read plan data for cloud run %s: %w

What it means

Thrown by Cloud.ShowPlanForRun when fetching plan JSON (either redacted via readRedactedPlan or unredacted via Plans.ReadJSONOutput) fails with any error other than tfe.ErrResourceNotFound. The wrapped %w carries the underlying cause.

Solutions

  1. Inspect the wrapped `%w` cause to classify transport vs server vs decode errors.
  2. Retry `terraform show` for transient failures.
  3. Verify connectivity/TLS to the TFE hostname.
  4. If the plan output is very large, retry on a stable connection.
Defensive patterns

Strategy: retry

Try / catch

jsonBytes, err = b.client.Plans.ReadJSONOutput(ctx, planID)
if err != nil && err != tfe.ErrResourceNotFound {
    // classify transient vs fatal; retry transient
}

Prevention

When it happens

Trigger: The plan-output fetch errors on a 5xx, network timeout, TLS issue, streaming-decode failure, or context cancellation. Distinct from the 404-specific messages, this covers all infrastructure-level failures of the plan-output endpoint.

Common situations: TFE plan-output service temporarily unavailable; large plan output timing out at a gateway; client-side context cancelled mid-download; transient network blip during `terraform show`.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/e156a47f82a31786. Report an issue: GitHub.

Appendix: source

Thrown at internal/cloud/backend_show.go:75

		// Bail, we can't use this.
		err = fmt.Errorf("can't display a cloud plan that is currently %s", r.Plan.Status)
		return nil, err
	}

	// Fetch the json plan!
	if redacted {
		jsonBytes, err = readRedactedPlan(ctx, b.client.BaseURL(), b.Token, r.Plan.ID)
	} else {
		jsonBytes, err = b.client.Plans.ReadJSONOutput(ctx, r.Plan.ID)
	}
	if err == tfe.ErrResourceNotFound {
		if redacted {
			return nil, fmt.Errorf("couldn't read plan data for cloud run %s; make sure you've run `terraform login` and that you have permission to view the run", runID)
		} else {
			return nil, fmt.Errorf("couldn't read unredacted JSON plan data for cloud run %s; make sure you've run `terraform login` and that you have admin permissions on the workspace", runID)
		}
	} else if err != nil {
		return nil, fmt.Errorf("couldn't read plan data for cloud run %s: %w", runID, err)
	}

	// Format a run header and footer
	header := strings.TrimSpace(fmt.Sprintf(runHeader, b.Hostname, b.Organization, r.Workspace.Name, r.ID))
	footer := strings.TrimSpace(statusFooter(r.Status, r.Actions.IsConfirmable, r.Workspace.Locked))

	out := &cloudplan.RemotePlanJSON{
		JSONBytes: jsonBytes,
		Redacted:  redacted,
		Mode:      mode,
		Qualities: opts,
		RunHeader: header,
		RunFooter: footer,
	}

	return out, nil
}

View on GitHub (pinned to d32a084675)