{"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/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/backend_show.go#L16-L52","documentation":"Returned by ShowPlanForRun when Runs.ReadWithOptions returns tfe.ErrResourceNotFound while fetching the run. Terraform interprets a 404 as either not being authenticated or lacking permission to view that run.","triggerScenarios":"Calling `terraform show` with a cloud run ID that does not exist, belongs to another org/workspace, or is inaccessible to the current token; the token is missing/expired so the API returns 404.","commonSituations":"Forgot to `terraform login`; token expired; run ID typo; run lives in a workspace the user has no read access to; run was discarded/deleted.","solutions":["Run `terraform login` (or set TF_TOKEN_<hostname>) and retry.","Verify the run ID is correct and that your user/team has read access to the workspace.","Confirm the run has not been discarded/removed in the HCP/TFE UI."],"exampleFix":"# before: no token / wrong token\nterraform show <plan ref run-xxxx>\n# after\nterraform login app.terraform.io\nterraform show <plan ref run-xxxx>","handlingStrategy":"validation","validationCode":"// Ensure a token exists and is valid before showing a run.\nif b.Token == \"\" {\n    return fmt.Errorf(\"not logged in; run `terraform login %s`\", b.Hostname)\n}","typeGuard":null,"tryCatchPattern":"r, err := b.client.Runs.ReadWithOptions(ctx, runID, opts)\nif errors.Is(err, tfe.ErrResourceNotFound) {\n    // prompt re-login or verify permissions, do not treat as transient\n}","preventionTips":["Always `terraform login` before `terraform show` on cloud plans.","Use TF_TOKEN_<hostname> in CI with least-privilege tokens.","Verify run ID spelling and workspace membership."],"tags":["terraform","cloud-backend","auth","permissions","show","not-found"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}