hashicorp/terraform · error

%s does not support the %q operation.

Error message


%s does not support the %q operation.

What it means

The default branch of the operation-type switch in Operation() (backend.go:932-934). The cloud/remote backend only implements handlers for Plan, Apply, and Refresh; any other operation type lands here and is reported as unsupported. Note Refresh is auto-rewritten to an apply-refresh before this switch's default, so the realistic triggers are import, state subcommands routed as operations, or a custom operation type.

Source

Thrown at internal/cloud/backend.go:933

			f = b.opQuery
		} else {
			f = b.opPlan
		}
	case backendrun.OperationTypeApply:
		f = b.opApply
	case backendrun.OperationTypeRefresh:
		// The `terraform refresh` command has been deprecated in favor of `terraform apply -refresh-state`.
		// Rather than respond with an error telling the user to run the other command we can just run
		// that command instead. We will tell the user what we are doing, and then do it.
		if b.CLI != nil {
			b.CLI.Output(b.Colorize().Color(strings.TrimSpace(refreshToApplyRefresh) + "\n"))
		}
		op.PlanMode = plans.RefreshOnlyMode
		op.PlanRefresh = true
		op.AutoApprove = true
		f = b.opApply
	default:
		return nil, fmt.Errorf(
			"\n\n%s does not support the %q operation.", b.appName, op.Type)
	}

	// Lock
	b.opLock.Lock()

	// Build our running operation
	// the runninCtx is only used to block until the operation returns.
	runningCtx, done := context.WithCancel(context.Background())
	runningOp := &backendrun.RunningOperation{
		Context:   runningCtx,
		PlanEmpty: true,
	}

	// stopCtx wraps the context passed in, and is used to signal a graceful Stop.
	stopCtx, stop := context.WithCancel(ctx)
	runningOp.Stop = stop

View on GitHub (pinned to c9def3e214)

Solutions

  1. Use a command variant the cloud backend supports (plan, apply, refresh); for state manipulation use 'terraform state' which uses a different path, or switch to local execution mode.
  2. If local execution is acceptable, set the workspace ExecutionMode to 'local' so operations route to b.local.Operation (backend.go:904) which supports more operation types.
  3. Upgrade Terraform; newer versions may add operation-type handling the message describes as unsupported.

Example fix

// before: cloud backend active, operation unsupported
// -> HCP Terraform does not support the "import" operation.
// after: run in local execution mode
cloud {
  organization = "my-org"
  workspaces { name = "app" }
  // set Execution Mode = Local in the workspace settings, OR
  // perform the operation against a local backend.
Defensive patterns

Strategy: validation

Validate before calling

// Only route supported operation types to the cloud backend.
func cloudSupports(opType backendrun.OperationType) bool {
    switch opType {
    case backendrun.OperationTypePlan, backendrun.OperationTypeApply, backendrun.OperationTypeRefresh:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: op.Type is set to a value other than OperationTypePlan, OperationTypeApply, or OperationTypeRefresh and reaches the switch at backend.go:912. For example, commands that the CLI maps to unsupported operation kinds when the cloud backend is selected.

Common situations: Running a command (e.g. certain state operations or import) that the CLI routes through the backend while the cloud backend is active and the command isn't among plan/apply/refresh. Typically a UX-level limitation rather than a config bug.

Related errors


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