{"record":{"id":"d59bf7c1fb751755","repo":"derailed/k9s","slug":"expecting-a-scalable-resource-for-q-d59bf7","errorCode":null,"errorMessage":"expecting a scalable resource for %q","messagePattern":"expecting a scalable resource for %q","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/view/scale_extender.go","lineNumber":225,"sourceCode":"\t\t\tSetBackgroundColorActivated(styles.ButtonFocusBgColor.Color()).\n\t\t\tSetLabelColorActivated(styles.ButtonFocusFgColor.Color())\n\t}\n\n\treturn f, nil\n}\n\nfunc (s *ScaleExtender) dismissDialog() {\n\ts.App().Content.RemovePage(scaleDialogKey)\n}\n\nfunc (s *ScaleExtender) scale(ctx context.Context, path string, replicas int32) error {\n\tres, err := dao.AccessorFor(s.App().factory, s.GVR())\n\tif err != nil {\n\t\treturn err\n\t}\n\tscaler, ok := res.(dao.Scalable)\n\tif !ok {\n\t\treturn fmt.Errorf(\"expecting a scalable resource for %q\", s.GVR())\n\t}\n\n\treturn scaler.Scale(ctx, path, replicas)\n}\n","sourceCodeStart":207,"sourceCodeEnd":230,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/scale_extender.go#L207-L230","documentation":"ScaleExtender.scale (internal/view/scale_extender.go:225) resolves the DAO for the GVR and asserts dao.Scalable (Scale(ctx, path, replicas)). If the accessor does not implement Scale, scaling is refused. In practice only DAOs for resources exposing the Kubernetes scale subresource implement it.","triggerScenarios":"Pressing the scale keybinding on a GVR whose DAO lacks Scale — custom CRDs without a scale subresource, or a generic accessor registered for an alias.","commonSituations":"Trying to scale CRDs (operators) that do not define `subresources: [scale]` in their CRD spec; k9s forks attaching ScaleExtender broadly; interface drift after upgrades.","solutions":["Verify the resource actually supports scaling (deployments, replicasets, statefulsets do)","For a CRD, add the scale subresource to the CRD spec (subresources.scale with statusReplicasPath / specReplicasPath / labelSelectorPath) so its DAO can implement Scale","Scale via kubectl to confirm server-side support: 'kubectl scale --replicas=N <gvr>/<name>'; if the server rejects it, the resource is not scalable at all","Remove the scale keybinding from non-scalable views"],"exampleFix":"# before: CRD without scale subresource -> expecting a scalable resource for \"mycrds.example.com\"\n# after: add to CRD spec\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nspec:\n  versions:\n    - name: v1\n      subresources:\n        scale:\n          specReplicasPath: .spec.replicas\n          statusReplicasPath: .status.replicas\n          labelSelectorPath: .status.labelSelector","handlingStrategy":"type-guard","validationCode":"// capability check before scaling\nres, err := dao.AccessorFor(s.App().factory, s.GVR())\nif err != nil { return err }\nif _, ok := res.(dao.Scalable); !ok {\n    return fmt.Errorf(\"%s does not support scale; add a scale subresource or use kubectl\", s.GVR())\n}","typeGuard":"func isScalable(res dao.Resource) (dao.Scalable, bool) {\n    sc, ok := res.(dao.Scalable)\n    return sc, ok\n}","tryCatchPattern":null,"preventionTips":["Ensure CRDs define subresources.scale so their DAOs can implement dao.Scalable","Bind the scale key only on deploy/rs/sts viewers","Compile-time assert: var _ dao.Scalable = (*MyDAO)(nil)"],"tags":["k9s","scale","crd","subresource","kubernetes"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}