rancher/rancher · error

failed to unmarshal kubeconfig: %w

Error message

failed to unmarshal kubeconfig: %w

What it means

Error "failed to unmarshal kubeconfig: %w" thrown in rancher/rancher.

Source

Thrown at pkg/api/norman/customization/cred/store.go:98

	}

	return nil
}

type Store struct {
	types.Store
	SecretLister     v1.SecretLister
	ProvClusterCache provv1.ClusterCache
	TokenLister      v3.TokenLister
}

type Set[E comparable] = map[E]struct{}

func TokenNamesFromContent(content []byte, tokens Set[string]) error {
	var kc store.KubeConfig
	err := yaml.Unmarshal(content, &kc)
	if err != nil {
		return fmt.Errorf("failed to unmarshal kubeconfig: %w", err)
	}

	for _, user := range kc.Users {
		if !strings.HasPrefix(user.User.Token, "kubeconfig-u-") && !strings.HasPrefix(user.User.Token, "kubeconfig-user-") {
			continue
		}
		tokenName, _, found := strings.Cut(user.User.Token, ":")
		if !found {
			return errors.New("unable to get token name from content")
		}
		tokens[tokenName] = struct{}{}
	}

	return nil
}

func (s *Store) processHarvesterCloudCredential(data map[string]any) error {
	if hc, ok := data["harvestercredentialConfig"].(map[string]any); ok && hc != nil {

View on GitHub (pinned to 932558d4e6)

When it happens

Trigger: Thrown at pkg/api/norman/customization/cred/store.go:98 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rancher/rancher@932558d4e6 (2026-08-16). Data as JSON: /api/errors/c727912bbec63f5b. Report an issue: GitHub.