hashicorp/terraform · error

couldn't read information for cloud run

Error message

couldn't read information for cloud run %s: %w

What it means

Thrown by Cloud.ShowPlanForRun when b.client.Runs.ReadWithOptions fails with any error other than tfe.ErrResourceNotFound. The wrapped %w carries the underlying transport, server, or decoding error from the TFE client.

Solutions

  1. Inspect the wrapped `%w` cause to identify transport, server, or auth errors.
  2. Retry the `terraform show` command for transient network/5xx failures.
  3. Verify network connectivity and TLS trust to the TFE hostname.
  4. If the context was cancelled, re-run without interrupting.
Defensive patterns

Strategy: retry

Try / catch

r, err := b.client.Runs.ReadWithOptions(ctx, runID, opts)
if err != nil && err != tfe.ErrResourceNotFound {
    // classify: transient -> retry; fatal -> surface
}

Prevention

When it happens

Trigger: Runs.ReadWithOptions errors on a 5xx server response, network timeout, TLS/cert error, response-decoding failure, or context cancellation. Distinct from 404 (handled at line 34), this is the catch-all for infrastructure-level failures.

Common situations: Self-hosted TFE temporarily down or restarting; a network partition between the client and TFE; an expired/invalid token producing a non-404 error; client context cancelled (e.g. Ctrl-C during show).

Related errors


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

Appendix: source

Thrown at internal/cloud/backend_show.go:36

// returns it in a cloudplan.RemotePlanJSON wrapper struct (along with various
// metadata required by terraform show). It's intended for use by the terraform
// show command, in order to format and display a saved cloud plan.
func (b *Cloud) ShowPlanForRun(ctx context.Context, runID, runHostname string, redacted bool) (*cloudplan.RemotePlanJSON, error) {
	var jsonBytes []byte
	mode := plans.NormalMode
	var opts []plans.Quality

	// Bail early if wrong hostname
	if runHostname != b.Hostname {
		return nil, fmt.Errorf("hostname for run (%s) does not match the configured cloud integration (%s)", runHostname, b.Hostname)
	}

	// Get run and plan
	r, err := b.client.Runs.ReadWithOptions(ctx, runID, &tfe.RunReadOptions{Include: []tfe.RunIncludeOpt{tfe.RunPlan, tfe.RunWorkspace}})
	if err == tfe.ErrResourceNotFound {
		return nil, fmt.Errorf("couldn't read information for cloud run %s; make sure you've run `terraform login` and that you have permission to view the run", runID)
	} else if err != nil {
		return nil, fmt.Errorf("couldn't read information for cloud run %s: %w", runID, err)
	}

	// Sort out the run mode
	if r.IsDestroy {
		mode = plans.DestroyMode
	} else if r.RefreshOnly {
		mode = plans.RefreshOnlyMode
	}

	// Check that the plan actually finished
	switch r.Plan.Status {
	case tfe.PlanErrored:
		// Errored plans might still be displayable, but we want to mention it to the renderer.
		opts = append(opts, plans.Errored)
	case tfe.PlanFinished:
		// Good to go, but alert the renderer if it has no changes.
		if !r.Plan.HasChanges {
			opts = append(opts, plans.NoChanges)

View on GitHub (pinned to d32a084675)