{"record":{"id":"5bffe2461b34c2e1","repo":"hashicorp/terraform","slug":"could-not-read-state-version-outputs-w","errorCode":null,"errorMessage":"could not read state version outputs: %w","messagePattern":"could not read state version outputs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/state.go","lineNumber":572,"sourceCode":"\t\tso, err = s.tfeClient.StateVersionOutputs.ReadCurrent(ctx, s.workspace.ID)\n\n\t\tif err != nil {\n\t\t\tif strings.Contains(err.Error(), \"service unavailable\") {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn NonRetryableError{err}\n\t\t}\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tswitch err {\n\t\tcase context.DeadlineExceeded:\n\t\t\treturn nil, fmt.Errorf(\"current outputs were not ready to be read within the deadline. Please try again\")\n\t\tcase context.Canceled:\n\t\t\treturn nil, fmt.Errorf(\"canceled reading current outputs\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"could not read state version outputs: %w\", err)\n\t}\n\n\tresult := make(map[string]*states.OutputValue)\n\n\tfor _, output := range so.Items {\n\t\tif output.DetailedType == nil {\n\t\t\t// If there is no detailed type information available, this state was probably created\n\t\t\t// with a version of terraform < 1.3.0. In this case, we'll eject completely from this\n\t\t\t// function and fall back to the old behavior of reading the entire state file, which\n\t\t\t// requires a higher level of authorization.\n\t\t\tlog.Printf(\"[DEBUG] falling back to reading full state\")\n\n\t\t\tif err := s.RefreshState(); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to load state: %w\", err)\n\t\t\t}\n\n\t\t\tstate := s.State()\n\t\t\tif state == nil {","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/state.go#L554-L590","documentation":"GetRootOutputValues' retry loop failed with an error that is neither deadline-exceeded nor cancellation. Typically StateVersionOutputs.ReadCurrent returned a non-retryable failure (auth, 404, etc.) wrapped in NonRetryableError.","triggerScenarios":"The token lacks permission to read outputs, the workspace/output is not found, or a non-503 API error occurs during ReadCurrent.","commonSituations":"Expired or under-scoped token, workspace deleted concurrently, or organization misconfiguration.","solutions":["Verify the token can read workspace outputs.","Confirm the workspace and organization are correct and still exist.","Re-authenticate with terraform login.","Retry if the underlying error looked transient."],"exampleFix":"# before: token without output-read scope -> could not read state version outputs\n# after: grant output-read / re-login, then retry\nterraform login app.terraform.io\nterraform output","handlingStrategy":"validation","validationCode":"// Pre-flight: confirm outputs endpoint is readable with current token\nif _, err := client.StateVersionOutputs.ReadCurrent(ctx, workspace.ID); err != nil {\n    return fmt.Errorf(\"cannot read state version outputs: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"outs, err := state.GetRootOutputValues(ctx)\nif err != nil && !isTransientHTTP(err) {\n    // non-retryable: fix token scope / workspace, then re-run\n}","preventionTips":["Ensure the token can read outputs","Verify org/workspace correctness","Re-authenticate on 401/403"],"tags":["outputs","retrieval","auth","permissions"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}