{"record":{"id":"d8b4fdf0db8a70f5","repo":"hashicorp/terraform","slug":"can-t-display-a-cloud-plan-that-is-currently-s","errorCode":null,"errorMessage":"can't display a cloud plan that is currently %s","messagePattern":"can't display a cloud plan that is currently (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/cloud/backend_show.go","lineNumber":58,"sourceCode":"\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)\n\t\t}\n\tdefault:\n\t\t// Bail, we can't use this.\n\t\terr = fmt.Errorf(\"can't display a cloud plan that is currently %s\", r.Plan.Status)\n\t\treturn nil, err\n\t}\n\n\t// Fetch the json plan!\n\tif redacted {\n\t\tjsonBytes, err = readRedactedPlan(ctx, b.client.BaseURL(), b.Token, r.Plan.ID)\n\t} else {\n\t\tjsonBytes, err = b.client.Plans.ReadJSONOutput(ctx, r.Plan.ID)\n\t}\n\tif err == tfe.ErrResourceNotFound {\n\t\tif redacted {\n\t\t\treturn 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)\n\t\t} else {\n\t\t\treturn 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)\n\t\t}\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't read plan data for cloud run %s: %w\", runID, err)\n\t}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/backend_show.go#L40-L76","documentation":"Returned by ShowPlanForRun when the run's Plan.Status is neither PlanFinished nor PlanErrored (e.g. pending, queued, running, canceled). A plan JSON is only downloadable once the plan has reached a displayable state.","triggerScenarios":"Showing a run while its plan phase is still in flight: status pending/queued/running/canceled/canceled. The switch falls to default and rejects displaying it.","commonSituations":"Running `terraform show -out` style display against a run that has not finished planning yet; race between starting a run and immediately showing it; plan that got canceled.","solutions":["Wait for the plan to reach 'finished' (or 'errored') in the UI/API and retry the show.","Poll the run status (Runs.Read) until r.Plan.Status is finished/errored before calling ShowPlanForRun.","If the plan was canceled, restart the run and wait for completion."],"exampleFix":"// before: show immediately after creating a run\njson, err := b.ShowPlanForRun(ctx, r.ID, host, true)\n// after: wait until plan is displayable\nfor r.Plan.Status == tfe.PlanPending || r.Plan.Status == tfe.PlanQueued {\n    r, _ = b.client.Runs.Read(ctx, r.ID)\n    time.Sleep(poll)\n}\njson, err := b.ShowPlanForRun(ctx, r.ID, host, true)","handlingStrategy":"validation","validationCode":"// Only call ShowPlanForRun once the plan is displayable.\nfunc planDisplayable(s tfe.PlanStatus) bool {\n    return s == tfe.PlanFinished || s == tfe.PlanErrored\n}\nif !planDisplayable(r.Plan.Status) {\n    return fmt.Errorf(\"plan still %s; wait and retry\", r.Plan.Status)\n}","typeGuard":"func isDisplayablePlanStatus(s tfe.PlanStatus) bool {\n    return s == tfe.PlanFinished || s == tfe.PlanErrored\n}","tryCatchPattern":null,"preventionTips":["Poll run.Plan.Status until finished/errored before showing.","Avoid racing show against a freshly created run.","Surface 'pending' as a wait condition, not an error, in wrappers."],"tags":["terraform","cloud-backend","plan-status","show","timing"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}