{"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/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/backend.go#L915-L951","documentation":"Default branch of the Operation type switch—every supported op type (plan/apply/refresh/etc.) is handled above; reaching the default means op.Type is something the cloud backend has no implementation for. Refresh is special-cased earlier and rewritten to apply -refresh-state, so it does not reach here.","triggerScenarios":"Calling code dispatches a backendrun.Operation with an OperationType not covered by the switch (e.g. a hypothetical console/import/unknown custom op). Practically reachable only by internal callers or future op types not yet wired into the cloud backend.","commonSituations":"End users essentially never see this; it appears when a tool built on the backend layer invokes an operation type the Cloud backend does not implement (e.g. an experimental op).","solutions":["Confirm the operation type is supported by the Cloud backend and use a local backend for ops it does not handle.","If you maintain a wrapper, map the unsupported op to one the backend implements (plan/apply/refresh) before dispatch.","File an issue / upgrade—the operation may be supported in a newer backend version."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before dispatching an op, confirm the backend supports it\nvar cloudSupportedOps = map[backendrun.OperationType]bool{\n    backendrun.OperationTypePlan: true,\n    backendrun.OperationTypeApply: true,\n    // refresh is rewritten internally; others are not\n}\nfunc dispatch(b backendrun.OperationsBackend, op *backendrun.Operation) error {\n    if !cloudSupportedOps[op.Type] {\n        return fmt.Errorf(\"op %v unsupported by cloud backend\", op.Type)\n    }\n    _, err := b.Operation(ctx, op)\n    return err\n}","typeGuard":"func isSupportedCloudOp(t backendrun.OperationType) bool {\n    switch t {\n    case backendrun.OperationTypePlan, backendrun.OperationTypeApply, backendrun.OperationTypeRefresh:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Filter operation types through a supported-ops table before dispatching to the cloud backend.","Use the local backend for operation types the cloud backend does not implement.","Keep wrapper code in sync with the backend's operation coverage."],"tags":["tfe","hcp","cloud-backend","operation","unsupported"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}