{"record":{"id":"af58bfd2abfe5fb4","repo":"derailed/k9s","slug":"unable-to-locate-replicas-from-s","errorCode":null,"errorMessage":"unable to locate replicas from %s","messagePattern":"unable to locate replicas from (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/view/scale_extender.go","lineNumber":105,"sourceCode":"}\n\nfunc (s *ScaleExtender) valueOf(col string) (string, error) {\n\tcolIdx, ok := s.GetTable().HeaderIndex(col)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"no column index for %s\", col)\n\t}\n\treturn s.GetTable().GetSelectedCell(colIdx), nil\n}\n\nfunc (s *ScaleExtender) replicasFromReady(_ string) (string, error) {\n\treplicas, err := s.valueOf(\"READY\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttokens := strings.Split(replicas, \"/\")\n\tif len(tokens) < 2 {\n\t\treturn \"\", fmt.Errorf(\"unable to locate replicas from %s\", replicas)\n\t}\n\n\treturn strings.TrimRight(tokens[1], ui.DeltaSign), nil\n}\n\nfunc (s *ScaleExtender) replicasFromScaleSubresource(sel string) (string, error) {\n\tres, err := dao.AccessorFor(s.App().factory, s.GVR())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treplicasGetter, ok := res.(dao.ReplicasGetter)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"expecting a replicasGetter resource for %q\", s.GVR())\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), s.App().Conn().Config().CallTimeout())\n\tdefer cancel()","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/scale_extender.go#L87-L123","documentation":"replicasFromReady (internal/view/scale_extender.go:105) reads the READY cell and splits it on '/', expecting at least two tokens ('current/desired'). It returns tokens[1] (the desired count, with the delta sign trimmed). If the cell is a bare number, a dash, or empty, there is no '/' and the error echoes the raw cell value.","triggerScenarios":"Scaling a resource whose READY cell does not render 'x/y' — a single-replica column format, a resource with no replicas status yet (just created, status subresource not populated), or a customized READY column that maps only readyReplicas instead of the pair.","commonSituations":"views.yaml override mapping READY to a single field; scaling a brand-new deployment before the status subresource reports readyCounts; CRDs whose READY semantics differ from deployments.","solutions":["Fix the READY column override in views.yaml to render 'ready/desired' (default columns) or remove the override","Scale from the scale subresource path instead — k9s falls back to replicasFromScaleSubresource when the READY heuristic is disabled; ensure the resource has a scale subresource","Wait until the controller populates .status (kubectl get <res> shows x/y) then retry","Fallback: kubectl scale <gvr>/<name> --replicas=N"],"exampleFix":"// before: READY cell renders \"1\" (single value)\n// strings.Split(\"1\", \"/\") -> [\"1\"] -> error: unable to locate replicas from 1\n\n// after: render the standard pair\n// READY cell renders \"1/3\" -> Split -> [\"1\",\"3\"] -> returns \"3\"","handlingStrategy":"validation","validationCode":"// validate the READY cell shape before splitting\ntokens := strings.Split(replicas, \"/\")\nif len(tokens) < 2 || tokens[1] == \"\" {\n    return \"\", fmt.Errorf(\"READY cell %q is not current/desired; use scale subresource instead\", replicas)\n}","typeGuard":null,"tryCatchPattern":"// fall back to the scale subresource when the heuristic parse fails\nreplicas, err := s.replicasFromReady(sel)\nif err != nil {\n    replicas, err = s.replicasFromScaleSubresource(sel)\n}","preventionTips":["Map READY to a ready/desired pair in custom column configs, not a single field","Scale resources that expose the scale subresource so k9s can read replicas server-side","Avoid scaling brand-new resources before the controller writes status"],"tags":["k9s","scale","replicas","table-parsing","views-config"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}