{"record":{"id":"31c7c7be64153b02","repo":"k3s-io/k3s","slug":"failed-to-parse-tolerations-from-annotation-s-v","errorCode":null,"errorMessage":"failed to parse tolerations from annotation %s: %v","messagePattern":"failed to parse tolerations from annotation (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cloudprovider/servicelb.go","lineNumber":714,"sourceCode":"\t\tif v, ok := svc.Annotations[priorityAnnotation]; ok {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn k.LBDefaultPriorityClassName\n}\n\n// getTolerations retrieves the tolerations from a service's annotations.\n// It parses the tolerations from a JSON or YAML string stored in the annotations.\nfunc (k *k3s) getTolerations(svc *core.Service) ([]core.Toleration, error) {\n\ttolerationsStr, ok := svc.Annotations[tolerationsAnnotation]\n\tif !ok {\n\t\treturn []core.Toleration{}, nil\n\t}\n\n\tvar tolerations []core.Toleration\n\tif err := json.Unmarshal([]byte(tolerationsStr), &tolerations); err != nil {\n\t\tif err := yaml.Unmarshal([]byte(tolerationsStr), &tolerations); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse tolerations from annotation %s: %v\", tolerationsAnnotation, err)\n\t\t}\n\t}\n\n\tfor i := range tolerations {\n\t\tif err := validateToleration(&tolerations[i]); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"validation failed for toleration %d: %v\", i, err)\n\t\t}\n\t}\n\n\treturn tolerations, nil\n}\n\n// validateToleration ensures a toleration has valid fields according to its operator.\nfunc validateToleration(toleration *core.Toleration) error {\n\tif toleration.Operator == \"\" {\n\t\ttoleration.Operator = core.TolerationOpEqual\n\t}\n","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/cloudprovider/servicelb.go#L696-L732","documentation":"Error \"failed to parse tolerations from annotation %s: %v\" thrown in k3s-io/k3s.","triggerScenarios":"Thrown at pkg/cloudprovider/servicelb.go:714 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}