k3s-io/k3s · error

failed to parse tolerations from annotation %s: %v

Error message

failed to parse tolerations from annotation %s: %v

What it means

Error "failed to parse tolerations from annotation %s: %v" thrown in k3s-io/k3s.

Source

Thrown at pkg/cloudprovider/servicelb.go:714

		if v, ok := svc.Annotations[priorityAnnotation]; ok {
			return v
		}
	}
	return k.LBDefaultPriorityClassName
}

// getTolerations retrieves the tolerations from a service's annotations.
// It parses the tolerations from a JSON or YAML string stored in the annotations.
func (k *k3s) getTolerations(svc *core.Service) ([]core.Toleration, error) {
	tolerationsStr, ok := svc.Annotations[tolerationsAnnotation]
	if !ok {
		return []core.Toleration{}, nil
	}

	var tolerations []core.Toleration
	if err := json.Unmarshal([]byte(tolerationsStr), &tolerations); err != nil {
		if err := yaml.Unmarshal([]byte(tolerationsStr), &tolerations); err != nil {
			return nil, fmt.Errorf("failed to parse tolerations from annotation %s: %v", tolerationsAnnotation, err)
		}
	}

	for i := range tolerations {
		if err := validateToleration(&tolerations[i]); err != nil {
			return nil, fmt.Errorf("validation failed for toleration %d: %v", i, err)
		}
	}

	return tolerations, nil
}

// validateToleration ensures a toleration has valid fields according to its operator.
func validateToleration(toleration *core.Toleration) error {
	if toleration.Operator == "" {
		toleration.Operator = core.TolerationOpEqual
	}

View on GitHub (pinned to 6ba341e396)

When it happens

Trigger: Thrown at pkg/cloudprovider/servicelb.go:714 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of k3s-io/k3s@6ba341e396 (2026-08-15). Data as JSON: /api/errors/31c7c7be64153b02. Report an issue: GitHub.