hashicorp/terraform · error

%s doesn't support %s

Error message

%s doesn't support %s

What it means

Thrown by the Cloud backend when creating a run whose op.PlanMode value does not match any of the known cases (NormalMode, RefreshOnlyMode, DestroyMode) in the switch statement. The message reports the application name (b.appName, e.g. "HCP Terraform") and the unrecognized plan mode. It indicates a Terraform core/Cloud-backend version skew: a new plan mode enum exists in core but the Cloud backend was not updated to map it to a RunCreateOptions field.

Source

Thrown at internal/cloud/backend_plan.go:164

		Workspace:            w,
		AutoApply:            tfe.Bool(op.AutoApprove),
		SavePlan:             tfe.Bool(op.PlanOutPath != ""),
	}

	switch op.PlanMode {
	case plans.NormalMode:
		// okay, but we don't need to do anything special for this
	case plans.RefreshOnlyMode:
		runOptions.RefreshOnly = tfe.Bool(true)
	case plans.DestroyMode:
		runOptions.IsDestroy = tfe.Bool(true)
	default:
		// Shouldn't get here because we should update this for each new
		// plan mode we add, mapping it to the corresponding RunCreateOptions
		// field.
		return nil, b.generalError(
			"Invalid plan mode",
			fmt.Errorf("%s doesn't support %s", b.appName, op.PlanMode),
		)
	}

	if len(op.Targets) != 0 {
		runOptions.TargetAddrs = make([]string, 0, len(op.Targets))
		for _, addr := range op.Targets {
			runOptions.TargetAddrs = append(runOptions.TargetAddrs, addr.String())
		}
	}

	if len(op.ActionTargets) != 0 {
		if len(op.ActionTargets) > 1 {
			// For now, we only support a single action from the command line.
			// We've future proofed the API and inputs so we can send multiple
			// but versions of Terraform will enforce this both here, and
			// on the other side.
			//
			// It shouldn't actually be possible to reach here anyway - we're

View on GitHub (pinned to c9def3e214)

Solutions

  1. Ensure the terraform binary and its internal/cloud backend are from the same release (reinstall/upgrade Terraform as a single unit).
  2. If you are developing a new plan mode, add the missing case in backend_plan.go:151 mapping op.PlanMode to the right RunCreateOptions field, then rebuild.
  3. Stop passing the unsupported/experimental flag (-destroy, -refresh-only are the supported CLI flags) and run a normal plan.

Example fix

// before: switch with no case for a new mode
case plans.NewMode: // unhandled -> falls to default -> error
// after: add an explicit case mapping the mode to a run option
case plans.NewMode:
    runOptions.SomeNewField = tfe.Bool(true)
Defensive patterns

Strategy: validation

Validate before calling

// Before creating a cloud run, validate the plan mode is one the backend handles.
func supportedPlanMode(m plans.Mode) bool {
    switch m {
    case plans.NormalMode, plans.RefreshOnlyMode, plans.DestroyMode:
        return true
    }
    return false
}
if !supportedPlanMode(op.PlanMode) {
    return fmt.Errorf("plan mode %v not supported by cloud backend", op.PlanMode)
}

Type guard

// go has no TS-style guard; model plan mode as a finite typed set
type supportedPlanMode struct{ mode plans.Mode }
func isKnownPlanMode(m plans.Mode) bool {
    return m == plans.NormalMode || m == plans.RefreshOnlyMode || m == plans.DestroyMode
}

Prevention

When it happens

Trigger: Reached only via the default branch of the op.PlanMode switch while the run is being built for a cloud workspace. Happens when a caller passes a plans.Mode value that the backend's switch has no case for (for example a brand-new mode added to the plans package before backend_plan.go gained a corresponding RunCreateOptions mapping).

Common situations: Mixing binaries from different Terraform versions, a custom build that adds a plan mode without patching the backend, or running an internal/experimental plan mode flag against a stock Cloud backend. End users on released versions should essentially never see this.

Related errors


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