kubernetes/kops · error

error fetching cluster %q: %v

Error message

error fetching cluster %q: %v

What it means

RunGetInstanceGroups resolves the cluster by name from the state store; this wraps GetCluster erroring - state store unreachable, permissions, or a malformed cluster config. It fires before any 'not found' check.

Source

Thrown at cmd/kops/get_instancegroups.go:99

			return completeInstanceGroup(f, &args, nil)(cmd, nil, toComplete)
		},
		RunE: func(cmd *cobra.Command, args []string) error {
			return RunGetInstanceGroups(cmd.Context(), f, out, &options)
		},
	}

	return cmd
}

func RunGetInstanceGroups(ctx context.Context, f commandutils.Factory, out io.Writer, options *GetInstanceGroupsOptions) error {
	clientset, err := f.KopsClient()
	if err != nil {
		return err
	}

	cluster, err := clientset.GetCluster(ctx, options.ClusterName)
	if err != nil {
		return fmt.Errorf("error fetching cluster %q: %v", options.ClusterName, err)
	}

	if cluster == nil {
		return fmt.Errorf("cluster %q was not found", options.ClusterName)
	}

	list, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
	if err != nil {
		return err
	}

	instancegroups, err := filterInstanceGroupsByName(options.InstanceGroupNames, list.Items)
	if err != nil {
		return err
	}

	singleObject := false

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped error for the state store failure reason
  2. Verify the cluster name and state store access
  3. Check credentials for the backing object store (S3/GCS)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/kops/get_instancegroups.go:99 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/6803c9697e21c0ff. Report an issue: GitHub.