{"record":{"id":"43fddb98a18af79b","repo":"GoogleContainerTools/skaffold","slug":"statuscheck-standalone-pods-fetch-err","errorCode":"STATUSCHECK_STANDALONE_PODS_FETCH_ERR","errorMessage":"could not fetch standalone pods: %w","messagePattern":"could not fetch standalone pods: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubernetes/status/status_check.go","lineNumber":208,"sourceCode":"\t\t\tresources = append(resources, d)\n\t\t\ts.seenResources.Add(d)\n\t\t}\n\n\t\tnewStatefulSets, err := getStatefulSets(ctx, client, n, s.labeller, getDeadline(s.deadlineSeconds), s.tolerateFailures)\n\t\tif err != nil {\n\t\t\treturn proto.StatusCode_STATUSCHECK_STATEFULSET_FETCH_ERR, fmt.Errorf(\"could not fetch statefulsets: %w\", err)\n\t\t}\n\t\tfor _, d := range newStatefulSets {\n\t\t\tif s.seenResources.Contains(d) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresources = append(resources, d)\n\t\t\ts.seenResources.Add(d)\n\t\t}\n\n\t\tnewStandalonePods, err := getStandalonePods(ctx, client, n, s.labeller, getDeadline((s.deadlineSeconds)), s.tolerateFailures)\n\t\tif err != nil {\n\t\t\treturn proto.StatusCode_STATUSCHECK_STANDALONE_PODS_FETCH_ERR, fmt.Errorf(\"could not fetch standalone pods: %w\", err)\n\t\t}\n\t\tfor _, pods := range newStandalonePods {\n\t\t\tif s.seenResources.Contains(pods) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresources = append(resources, pods)\n\t\t\ts.seenResources.Add(pods)\n\t\t}\n\n\t\tnewConfigConnectorResources, err := getConfigConnectorResources(client, dynClient, s.manifests, n, s.labeller, getDeadline(s.deadlineSeconds), s.tolerateFailures)\n\t\tif err != nil {\n\t\t\treturn proto.StatusCode_STATUSCHECK_CONFIG_CONNECTOR_RESOURCES_FETCH_ERR, fmt.Errorf(\"could not fetch config connector resources: %w\", err)\n\t\t}\n\t\tfor _, d := range newConfigConnectorResources {\n\t\t\tif s.seenResources.Contains(d) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresources = append(resources, d)","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubernetes/status/status_check.go#L190-L226","documentation":"statusCheck wraps failures from getStandalonePods with this message and STATUSCHECK_STANDALONE_PODS_FETCH_ERR. The inner error is produced when NewStandalonePodsSelector(client).Select(...) cannot list pods filtered by the run-id label.","triggerScenarios":"selector.Select(ctx, ns, metav1.ListOptions{LabelSelector: l.RunIDSelector()}) errors: RBAC denies listing pods, namespace missing, API server unreachable, or invalid label selector string.","commonSituations":"Namespaces lacking pod list permissions (common in multi-tenant clusters); nonexistent namespace passed via skaffold config statusCheck.namespace; cluster unreachable after network switch; selector label encoding issues after labeller changes.","solutions":["Run 'kubectl auth can-i list pods -n <ns>' and fix RBAC (add pods to get/list/watch resources)","Verify the namespace in skaffold.yaml statusCheck settings exists","Confirm cluster connectivity: 'kubectl get pods -n <ns>'","Check the labeller's run-id label for empty/invalid characters (e.g. runID with illegal label values)","Retry once the cluster/credentials are healthy"],"exampleFix":"// before: namespace 'prod ' (trailing space) in skaffold.yaml\n//   statusCheck: { namespace: 'prod ' }\n// after:\n//   statusCheck: { namespace: 'prod' }","handlingStrategy":"try-catch","validationCode":"const canList = execSync(`kubectl auth can-i list pods -n ${ns}`).toString().trim();\nif (canList !== 'yes') throw new Error(`RBAC: cannot list pods in ${ns}`);","typeGuard":"function isStandalonePodsFetchErr(err) {\n  return err != null && typeof err.message === 'string' && err.message.includes('could not fetch standalone pods');\n}","tryCatchPattern":"try {\n  await statusCheck();\n} catch (err) {\n  if (err.message.includes('could not fetch standalone pods')) {\n    log.error('pod list failed:', err.cause ?? err.message);\n  }\n  throw err;\n}","preventionTips":["Grant pods get/list/watch wherever statusCheck namespaces are used","Double-check statusCheck.namespace for typos/whitespace","Validate run-id label values are valid Kubernetes label values","Verify connectivity (kubectl get pods) before long status checks"],"tags":["kubernetes","rbac","pods","api-server"],"backgroundTag":"kubernetes-api-list-forbidden","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}