{"record":{"id":"47d9e3372b033449","repo":"hashicorp/terraform","slug":"couldn-t-read-information-for-cloud-run-s-w","errorCode":null,"errorMessage":"couldn't read information for cloud run %s: %w","messagePattern":"couldn't read information for cloud run (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend_show.go","lineNumber":36,"sourceCode":"// returns it in a cloudplan.RemotePlanJSON wrapper struct (along with various\n// metadata required by terraform show). It's intended for use by the terraform\n// show command, in order to format and display a saved cloud plan.\nfunc (b *Cloud) ShowPlanForRun(ctx context.Context, runID, runHostname string, redacted bool) (*cloudplan.RemotePlanJSON, error) {\n\tvar jsonBytes []byte\n\tmode := plans.NormalMode\n\tvar opts []plans.Quality\n\n\t// Bail early if wrong hostname\n\tif runHostname != b.Hostname {\n\t\treturn nil, fmt.Errorf(\"hostname for run (%s) does not match the configured cloud integration (%s)\", runHostname, b.Hostname)\n\t}\n\n\t// Get run and plan\n\tr, err := b.client.Runs.ReadWithOptions(ctx, runID, &tfe.RunReadOptions{Include: []tfe.RunIncludeOpt{tfe.RunPlan, tfe.RunWorkspace}})\n\tif err == tfe.ErrResourceNotFound {\n\t\treturn 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)\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't read information for cloud run %s: %w\", runID, err)\n\t}\n\n\t// Sort out the run mode\n\tif r.IsDestroy {\n\t\tmode = plans.DestroyMode\n\t} else if r.RefreshOnly {\n\t\tmode = plans.RefreshOnlyMode\n\t}\n\n\t// Check that the plan actually finished\n\tswitch r.Plan.Status {\n\tcase tfe.PlanErrored:\n\t\t// Errored plans might still be displayable, but we want to mention it to the renderer.\n\t\topts = append(opts, plans.Errored)\n\tcase tfe.PlanFinished:\n\t\t// Good to go, but alert the renderer if it has no changes.\n\t\tif !r.Plan.HasChanges {\n\t\t\topts = append(opts, plans.NoChanges)","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/backend_show.go#L18-L54","documentation":"Returned by ShowPlanForRun when Runs.ReadWithOptions fails with any error other than tfe.ErrResourceNotFound. The underlying error is wrapped so the caller sees the full cause (network, 5xx, context cancellation, JSON decode, etc.).","triggerScenarios":"API call to read the run returns a non-404 failure: 5xx server error, timeout, TLS/DNS error, rate limiting, context cancellation, or an unexpected response body.","commonSituations":"TFE/HCP outage or degraded API; transient network blip; proxy/firewall blocking the API; CI runner with short context timeouts; rate-limited token.","solutions":["Read the wrapped %w cause to identify whether it is network, auth, or server-side.","Retry after a brief wait; for 429/5xx back off exponentially.","Check TFE/HCP status page and network/proxy connectivity from the runner.","Increase the operation/context timeout if it is a deadline-exceeded error."],"exampleFix":"// before\nrun, err := b.client.Runs.ReadWithOptions(ctx, runID, opts)\n// after: inspect the wrapped error and retry on transient failures\nif err != nil && !errors.Is(err, tfe.ErrResourceNotFound) {\n    if isTransient(err) { /* backoff and retry */ } else { return fmt.Errorf(\"...: %w\", err) }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"func isTransientReadErr(err error) bool {\n    var netErr net.Error\n    if errors.As(err, &netErr) && netErr.Timeout() { return true }\n    if strings.Contains(err.Error(), \"500\") || strings.Contains(err.Error(), \"502\") || strings.Contains(err.Error(), \"503\") { return true }\n    return false\n}","tryCatchPattern":"var run *tfe.Run\nbackoff := time.Second\nfor attempt := 0; attempt < 3; attempt++ {\n    run, err = b.client.Runs.ReadWithOptions(ctx, runID, opts)\n    if err == nil { break }\n    if errors.Is(err, tfe.ErrResourceNotFound) || !isTransientReadErr(err) { break }\n    time.Sleep(backoff); backoff *= 2\n}","preventionTips":["Wrap Reads in a retry-with-backoff for transient errors.","Set a generous context deadline so 5xx backoff can complete.","Surface the wrapped cause for diagnostics."],"tags":["terraform","cloud-backend","network","api-error","show","retry"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}