{"record":{"id":"7ebcb3183027d91d","repo":"hashicorp/terraform","slug":"s-does-not-support-the-q-operation","errorCode":null,"errorMessage":"\n\n%s does not support the %q operation.","messagePattern":"\n\n(.+?) does not support the %q operation\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/backend.go","lineNumber":933,"sourceCode":"\t\t\tf = b.opQuery\n\t\t} else {\n\t\t\tf = b.opPlan\n\t\t}\n\tcase backendrun.OperationTypeApply:\n\t\tf = b.opApply\n\tcase backendrun.OperationTypeRefresh:\n\t\t// The `terraform refresh` command has been deprecated in favor of `terraform apply -refresh-state`.\n\t\t// Rather than respond with an error telling the user to run the other command we can just run\n\t\t// that command instead. We will tell the user what we are doing, and then do it.\n\t\tif b.CLI != nil {\n\t\t\tb.CLI.Output(b.Colorize().Color(strings.TrimSpace(refreshToApplyRefresh) + \"\\n\"))\n\t\t}\n\t\top.PlanMode = plans.RefreshOnlyMode\n\t\top.PlanRefresh = true\n\t\top.AutoApprove = true\n\t\tf = b.opApply\n\tdefault:\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"\\n\\n%s does not support the %q operation.\", b.appName, op.Type)\n\t}\n\n\t// Lock\n\tb.opLock.Lock()\n\n\t// Build our running operation\n\t// the runninCtx is only used to block until the operation returns.\n\trunningCtx, done := context.WithCancel(context.Background())\n\trunningOp := &backendrun.RunningOperation{\n\t\tContext:   runningCtx,\n\t\tPlanEmpty: true,\n\t}\n\n\t// stopCtx wraps the context passed in, and is used to signal a graceful Stop.\n\tstopCtx, stop := context.WithCancel(ctx)\n\trunningOp.Stop = stop\n","sourceCodeStart":915,"sourceCodeEnd":951,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/cloud/backend.go#L915-L951","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","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.","Upgrade Terraform; newer versions may add operation-type handling the message describes as unsupported."],"exampleFix":"// before: cloud backend active, operation unsupported\n// -> HCP Terraform does not support the \"import\" operation.\n// after: run in local execution mode\ncloud {\n  organization = \"my-org\"\n  workspaces { name = \"app\" }\n  // set Execution Mode = Local in the workspace settings, OR\n  // perform the operation against a local backend.","handlingStrategy":"validation","validationCode":"// Only route supported operation types to the cloud backend.\nfunc cloudSupports(opType backendrun.OperationType) bool {\n    switch opType {\n    case backendrun.OperationTypePlan, backendrun.OperationTypeApply, backendrun.OperationTypeRefresh:\n        return true\n    }\n    return false\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer local execution mode for state/import operations not supported by the remote backend.","Check the supported operation set before dispatching an op to the cloud backend."],"tags":["terraform","cloud-backend","operations","unsupported"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}