GoogleContainerTools/skaffold · error

could not fetch standalone pods: %w

Error message

could not fetch standalone pods: %w

What it means

Inside getStandalonePods, any error from listing pods via the standalone-pods selector is wrapped as 'could not fetch standalone pods' with the underlying error (%w). It bubbles to statusCheck's STATUSCHECK_STANDALONE_PODS_FETCH_ERR.

Source

Thrown at pkg/skaffold/kubernetes/status/status_check.go:291

	// Retrieve pending resource statuses
	go func() {
		s.printResourceStatus(ctx, out, resources)
	}()

	// Wait for all deployment statuses to be fetched
	wg.Wait()
	return getSkaffoldDeployStatus(ctx, c, exitStatus)
}

func getStandalonePods(ctx context.Context, client kubernetes.Interface, ns string, l *label.DefaultLabeller, deadlineDuration time.Duration, tolerateFailures bool) ([]*resource.Resource, error) {
	var result []*resource.Resource
	selector := validator.NewStandalonePodsSelector(client)
	pods, err := selector.Select(ctx, ns, metav1.ListOptions{
		LabelSelector: l.RunIDSelector(),
	})
	if err != nil {
		return nil, fmt.Errorf("could not fetch standalone pods: %w", err)
	}
	if len(pods) == 0 {
		return result, nil
	}
	pd := diag.New([]string{ns}).
		WithLabel(label.RunIDLabel, l.Labels()[label.RunIDLabel]).
		WithValidators([]validator.Validator{validator.NewPodValidator(client, selector)})
	result = append(result, resource.NewResource(string(resource.ResourceTypes.StandalonePods), resource.ResourceTypes.StandalonePods, ns, deadlineDuration, tolerateFailures).WithValidator(pd))

	return result, nil
}

func getConfigConnectorResources(client kubernetes.Interface, dynClient dynamic.Interface, m manifest.ManifestList, ns string, l *label.DefaultLabeller, deadlineDuration time.Duration, tolerateFailures bool) ([]*resource.Resource, error) {
	var result []*resource.Resource
	uRes, err := m.SelectResources(manifest.ConfigConnectorResourceSelector...)
	if err != nil {
		return nil, fmt.Errorf("could not fetch config connector resources: %w", err)
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Verify RBAC: 'kubectl auth can-i list pods -n <ns>' and add pods to the role if denied
  2. Correct the namespace configured for the status check
  3. Test with 'kubectl get pods -n <ns> --selector=<run-id-selector>' to reproduce the exact list call
  4. Check label selector validity from the labeller's run-id label value
  5. Retry once cluster connectivity is restored

Example fix

// before: role limited to deployments only
//   kubectl create role ci --verb=get,list --resource=deployments.apps
// after:
//   kubectl create role ci --verb=get,list,watch --resource=deployments.apps,pods
Defensive patterns

Strategy: try-catch

Validate before calling

const canList = execSync(`kubectl auth can-i list pods -n ${ns}`).toString().trim();
if (canList !== 'yes') throw new Error(`RBAC: cannot list pods in ${ns}`);

Type guard

function isStandalonePodsFetchErr(err) {
  return err != null && typeof err.message === 'string' && err.message.includes('could not fetch standalone pods');
}

Try / catch

try {
  await statusCheck();
} catch (err) {
  if (isStandalonePodsFetchErr(err)) {
    // unwrap cause: RBAC (403) vs network vs namespace
    log.error('standalone pod listing failed:', err.cause ?? err.message);
  }
  throw err;
}

Prevention

When it happens

Trigger: NewStandalonePodsSelector(client).Select(ctx, ns, metav1.ListOptions{LabelSelector: l.RunIDSelector()}) fails: pods not listable in the namespace (RBAC), namespace absent, or API/network error.

Common situations: Multi-tenant cluster where the service account can't list pods; wrong statusCheck.namespace; cluster hiccups at status-check time after deploy; labeller run-id producing an invalid selector.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/f84d1dd34e613056. Report an issue: GitHub.