derailed/k9s · error

unable to locate replicas from %s

Error message

unable to locate replicas from %s

What it means

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.

Source

Thrown at internal/view/scale_extender.go:105

}

func (s *ScaleExtender) valueOf(col string) (string, error) {
	colIdx, ok := s.GetTable().HeaderIndex(col)
	if !ok {
		return "", fmt.Errorf("no column index for %s", col)
	}
	return s.GetTable().GetSelectedCell(colIdx), nil
}

func (s *ScaleExtender) replicasFromReady(_ string) (string, error) {
	replicas, err := s.valueOf("READY")
	if err != nil {
		return "", err
	}

	tokens := strings.Split(replicas, "/")
	if len(tokens) < 2 {
		return "", fmt.Errorf("unable to locate replicas from %s", replicas)
	}

	return strings.TrimRight(tokens[1], ui.DeltaSign), nil
}

func (s *ScaleExtender) replicasFromScaleSubresource(sel string) (string, error) {
	res, err := dao.AccessorFor(s.App().factory, s.GVR())
	if err != nil {
		return "", err
	}

	replicasGetter, ok := res.(dao.ReplicasGetter)
	if !ok {
		return "", fmt.Errorf("expecting a replicasGetter resource for %q", s.GVR())
	}

	ctx, cancel := context.WithTimeout(context.Background(), s.App().Conn().Config().CallTimeout())
	defer cancel()

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Fix the READY column override in views.yaml to render 'ready/desired' (default columns) or remove the override
  2. 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
  3. Wait until the controller populates .status (kubectl get <res> shows x/y) then retry
  4. Fallback: kubectl scale <gvr>/<name> --replicas=N

Example fix

// before: READY cell renders "1" (single value)
// strings.Split("1", "/") -> ["1"] -> error: unable to locate replicas from 1

// after: render the standard pair
// READY cell renders "1/3" -> Split -> ["1","3"] -> returns "3"
Defensive patterns

Strategy: validation

Validate before calling

// validate the READY cell shape before splitting
tokens := strings.Split(replicas, "/")
if len(tokens) < 2 || tokens[1] == "" {
    return "", fmt.Errorf("READY cell %q is not current/desired; use scale subresource instead", replicas)
}

Try / catch

// fall back to the scale subresource when the heuristic parse fails
replicas, err := s.replicasFromReady(sel)
if err != nil {
    replicas, err = s.replicasFromScaleSubresource(sel)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15). Data as JSON: /api/errors/af58bfd2abfe5fb4. Report an issue: GitHub.