{"record":{"id":"0fef894f05a82e94","repo":"hashicorp/terraform","slug":"canceled-reading-current-outputs","errorCode":null,"errorMessage":"canceled reading current outputs","messagePattern":"canceled reading current outputs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/cloud/state.go","lineNumber":570,"sourceCode":"\terr := RetryBackoff(ctx, func() error {\n\t\tvar err error\n\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","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/state.go#L552-L588","documentation":"The context passed to GetRootOutputValues was cancelled (e.g. the user pressed interrupt) while it was retrying or reading outputs. This is an intentional cancellation, not a state failure.","triggerScenarios":"User presses Ctrl-C, or a parent context is cancelled during output retrieval.","commonSituations":"Interrupting an operation, CI job cancellation, or an outer context timeout firing mid-read.","solutions":["This is expected on cancellation; no fix is needed, just re-run when ready.","Avoid cancelling mid-read if you need the outputs.","Treat the error as benign (context.Canceled) rather than a state error."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"outs, err := state.GetRootOutputValues(ctx)\nif err != nil {\n    if errors.Is(err, context.Canceled) || errors.Is(ctx.Err(), context.Canceled) {\n        // benign cancellation; do not treat as a state error\n        return nil\n    }\n    return err\n}","preventionTips":["Distinguish cancellation from real errors in your handler","Avoid interrupting mid-read when outputs are needed","Propagate context cleanly so cancellation is explicit"],"tags":["outputs","cancellation","interrupt"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}