hashicorp/terraform · warning · ErrRequestCanceled
request was canceled
Error message
request was canceled
What it means
ErrRequestCanceled is returned by GetManifest / DownloadFile when the underlying HTTP request failed because the provided context was cancelled (errors.Is(err, context.Canceled)). It distinguishes a user-initiated or parent cancellation from a genuine network/transport failure so callers can stop retrying.
Source
Thrown at internal/pluginshared/errors.go:17
// Copyright IBM Corp. 2014, 2026
// SPDX-License-Identifier: BUSL-1.1
package pluginshared
import (
"errors"
"fmt"
)
var (
// ErrPluginNotSupported is the error returned when the upstream HCP Terraform does not
// have a manifest.
ErrPluginNotSupported = errors.New("plugin is not supported by the remote version of Terraform Enterprise")
// ErrRequestCanceled is the error returned when the context was cancelled.
ErrRequestCanceled = errors.New("request was canceled")
// ErrArchNotSupported is the error returned when the plugin does not have a build for the
// current OS/Architecture.
ErrArchNotSupported = errors.New("plugin is not supported by your computer architecture/operating system")
// ErrPluginNotFound is the error returned when the plugin manifest points to a location
// that was does not exist.
ErrPluginNotFound = errors.New("plugin download was not found in the location specified in the manifest")
)
// ErrQueryFailed is the error returned when the plugin http client request fails
type ErrQueryFailed struct {
inner error
}
// ErrCloudPluginNotVerified is the error returned when the archive authentication process fails
type ErrCloudPluginNotVerified struct {
inner errorView on GitHub (pinned to d32a084675)
Solutions
- Treat ErrRequestCanceled as terminal — do not retry; surface 'cancelled by user' to the user.
- If cancellations are unexpected, audit the context lifecycle upstream to find premature cancellation (e.g. a request-scoped context being reused).
- Increase or remove the deadline on the parent context if the operation legitimately needs more time.
- Separate user-cancellation handling from network-error handling using errors.Is(err, pluginshared.ErrRequestCanceled).
Example fix
// before
err := client.DownloadFile(url, &buf)
if err != nil {
log.Fatalf("download failed: %v", err)
}
// after
err := client.DownloadFile(url, &buf)
if errors.Is(err, pluginshared.ErrRequestCanceled) {
log.Println("download cancelled")
return ctx.Err()
}
if err != nil {
log.Fatalf("download failed: %v", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pass a context with the deadline you actually want
ctx, cancel := context.WithTimeout(parentCtx, 60*time.Second)
defer cancel()
client := BasePluginClient{ctx: ctx, /* ... */} Type guard
func isRequestCanceled(err error) bool {
return errors.Is(err, pluginshared.ErrRequestCanceled) || errors.Is(err, context.Canceled)
} Try / catch
if err := client.DownloadFile(url, &buf); err != nil {
if errors.Is(err, pluginshared.ErrRequestCanceled) {
return ctx.Err() // stop retrying
}
return err
} Prevention
- Do not reuse request-scoped contexts across multiple operations.
- Distinguish cancellation from real errors so retry loops exit cleanly.
- Surface 'cancelled by user' messaging rather than treating cancellation as a failure.
When it happens
Trigger: The context passed to BasePluginClient (b.ctx) is cancelled while httpClient.Do(req) is in flight, OR the retryablehttp transport surfaces context.Canceled. Detected at client.go:214-216 (DownloadFile) and the analogous check in GetManifest.
Common situations: User pressed Ctrl+C during a plugin download/manifest fetch; a parent operation timed out and cancelled its context; a CI runner was killed; SIGTERM propagation cancelled the request.
Related errors
- canceled reading current outputs
- plugin is not supported by your computer architecture/operat
- plugin download was not found in the location specified in t
- current outputs were not ready to be read within the deadlin
- Provider installation was canceled by an interrupt signal.
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/b864311b4c684ba4.
Report an issue: GitHub.