hashicorp/terraform · warning · ErrRequestCanceled

ErrRequestCanceled

ErrRequestCanceled

Error message

request was canceled

What it means

ErrRequestCanceled is a sentinel error returned by the pluginshared HTTP client when the request's context is canceled (errors.Is(err, context.Canceled)) during FetchManifest or DownloadFile. It is an intentional cancellation signal, not a transport failure, and is propagated so callers can distinguish a user-initiated stop from a genuine network error.

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 error

View on GitHub (pinned to c9def3e214)

Solutions

  1. Treat as expected: if the user interrupted, no fix is needed — rerun the command when ready.
  2. If it happens unprompted, raise the timeout on the parent context or the CI step that wraps the operation.
  3. Check that no wrapper script is sending SIGINT/SIGTERM prematurely.
  4. If recurring in automation, ensure the runner's job timeout exceeds the worst-case plugin download time.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pass a context you control; cancel only on real interrupts.
ctx, cancel := context.WithCancel(parentCtx)
defer cancel()
// client.FetchManifest uses b.ctx internally; build it from ctx.

Type guard

func isRequestCanceled(err error) bool {
    return errors.Is(err, pluginshared.ErrRequestCanceled) || errors.Is(err, context.Canceled) || errors.Is(err, getproviders.ErrRequestCanceled{})
}

Try / catch

rel, err := client.FetchManifest(lastModified)
if errors.Is(err, pluginshared.ErrRequestCanceled) {
    // intentional cancel: exit cleanly, do not retry
    return nil
}

Prevention

When it happens

Trigger: Returned at internal/pluginshared/client.go:175 (FetchManifest) and :215 (DownloadFile) when the underlying retryablehttp request fails and errors.Is(err, context.Canceled) is true. Also surfaced by the getproviders layer as ErrRequestCanceled{} (internal/getproviders/errors.go:224).

Common situations: User pressed Ctrl+C during `terraform init` while a plugin/manifest download is in flight. A parent operation (plan/apply) was canceled or hit its deadline. An automation runner (CI) canceled the step on timeout. A context with a short timeout was attached to the plugin fetch.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/42462ec6d8b2b85e. Report an issue: GitHub.