{"record":{"id":"7fedd4ebb1e28a7f","repo":"hashicorp/terraform","slug":"couldn-t-read-plan-data-for-cloud-run-s-make-sur","errorCode":null,"errorMessage":"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","messagePattern":"couldn't read plan data for cloud run (.+?); make sure you've run `terraform login` and that you have permission to view the run","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend_show.go","lineNumber":70,"sourceCode":"\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}\n\n\t// Format a run header and footer\n\theader := strings.TrimSpace(fmt.Sprintf(runHeader, b.Hostname, b.Organization, r.Workspace.Name, r.ID))\n\tfooter := strings.TrimSpace(statusFooter(r.Status, r.Actions.IsConfirmable, r.Workspace.Locked))\n\n\tout := &cloudplan.RemotePlanJSON{\n\t\tJSONBytes: jsonBytes,\n\t\tRedacted:  redacted,\n\t\tMode:      mode,\n\t\tQualities: opts,\n\t\tRunHeader: header,\n\t\tRunFooter: footer,","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend_show.go#L52-L88","documentation":"Thrown by Cloud.ShowPlanForRun when readRedactedPlan returns tfe.ErrResourceNotFound while requesting the redacted plan JSON. The redacted (safe-to-share) plan output endpoint returned 404, meaning the caller cannot view the plan — typically an auth or permission gap on the run.","triggerScenarios":"redacted=true path (the default `terraform show` of a cloud plan); readRedactedPlan hits the redacted-plan-output URL and gets 404. The token lacks read access to the plan output, or is absent entirely.","commonSituations":"Token not logged in; token's team lacks 'Plan Outputs: Read'; the plan output was garbage-collected or never generated (e.g. an empty/alien plan).","solutions":["Run `terraform login` against the correct hostname.","Ensure the token's team has read access to plan outputs on the workspace.","Retry once authenticated; if still 404, the plan output may be unavailable — request an unredacted view if you have admin access."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm token has plan-output read before show.\nif b.Token == \"\" { return errors.New(\"run `terraform login` first\") }","typeGuard":null,"tryCatchPattern":"jsonBytes, err = readRedactedPlan(ctx, baseURL, b.Token, planID)\nif err == tfe.ErrResourceNotFound {\n    // prompt login / permissions; consider unredacted if admin\n}","preventionTips":["Ensure 'Plan Outputs: Read' on the workspace.","Run `terraform login` before showing cloud plans.","Use redacted output by default; reserve unredacted for admins."],"tags":["terraform","show","cloud-plan","redacted","auth","permissions","not-found"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}