{"record":{"id":"9b0b22ed32b1a040","repo":"hashicorp/terraform","slug":"couldn-t-read-information-for-cloud-run-s-make-s","errorCode":null,"errorMessage":"couldn't read information for cloud run %s; make sure you've run `terraform login` and that you have permission to view the run","messagePattern":"couldn't read information 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":34,"sourceCode":"// ShowPlanForRun downloads the JSON plan output for the specified cloud run\n// (either the redacted or unredacted format, per the caller's request), and\n// 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.","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend_show.go#L16-L52","documentation":"Thrown by Cloud.ShowPlanForRun when b.client.Runs.ReadWithOptions returns exactly tfe.ErrResourceNotFound. The TFE API could not find the run ID, which most commonly means the request is unauthenticated or the caller lacks permission — TFE returns 404 rather than 403 for hidden resources. The message prompts `terraform login` and permission verification.","triggerScenarios":"ShowPlanForRun is given a runID whose run is invisible to the current token: either no token (no `terraform login`), a token for a different org/user, or a token whose team cannot view the run. The API returns 404 → ErrResourceNotFound.","commonSituations":"Forgetting to `terraform login` before `terraform show`; using a token from a different org than the run; the run was deleted or belongs to a workspace the team has no access to; cross-org plan viewing.","solutions":["Run `terraform login` and authenticate against the correct hostname.","Verify the run ID is correct and belongs to a workspace your team can view.","Confirm the token's team has 'Runs: Read' permission on the workspace.","Check that the run was not discarded/deleted in the HCP Terraform UI."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure a token exists and the run is viewable before show.\nif b.Token == \"\" {\n    return errors.New(\"no token; run `terraform login`\")\n}","typeGuard":null,"tryCatchPattern":"r, err := b.client.Runs.ReadWithOptions(ctx, runID, opts)\nif err == tfe.ErrResourceNotFound {\n    // prompt login / check permissions, do not retry blindly\n}","preventionTips":["Run `terraform login` before any `terraform show` of a cloud plan.","Confirm the token's team has 'Runs: Read'.","Verify the run ID belongs to an accessible workspace."],"tags":["terraform","show","cloud-plan","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"}