{"record":{"id":"0c7da6e69fbbbe77","repo":"kubernetes/kops","slug":"could-not-get-spec-version-from-clusterpackage","errorCode":null,"errorMessage":"could not get spec.version from ClusterPackage","messagePattern":"could not get spec\\.version from ClusterPackage","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wellknownoperators/operators.go","lineNumber":84,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\tif keep {\n\t\t\tkeepObjects = append(keepObjects, object)\n\t\t}\n\t}\n\treturn packages, keepObjects, nil\n}\n\nfunc (b *Builder) loadClusterPackage(u *unstructured.Unstructured) (*Package, error) {\n\toperatorKey := u.GetName()\n\tif operatorKey == \"\" {\n\t\treturn nil, fmt.Errorf(\"could not get name from ClusterPackage\")\n\t}\n\n\toperatorVersion, _, err := unstructured.NestedString(u.Object, \"spec\", \"version\")\n\tif err != nil || operatorVersion == \"\" {\n\t\treturn nil, fmt.Errorf(\"could not get spec.version from ClusterPackage\")\n\t}\n\n\tid := operatorVersion\n\n\tlocation := path.Join(\"packages\", operatorKey, operatorVersion, \"manifest.yaml\")\n\tchannelURL, err := kops.ResolveChannel(b.Cluster.Spec.Channel)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error resolving channel %q: %v\", b.Cluster.Spec.Channel, err)\n\t}\n\n\tlocationURL := channelURL.ResolveReference(&url.URL{Path: location}).String()\n\n\tmanifestBytes, err := b.VFSContext.ReadFile(locationURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading operator manifest %q: %v\", locationURL, err)\n\t}\n\n\taddon := &Package{","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/wellknownoperators/operators.go#L66-L102","documentation":"loadClusterPackage reads a ClusterPackage custom object from the cluster's AdditionalObjects; spec.version was absent, empty, or not a string (NestedString error), so kOps cannot locate packages/<name>/<version>/manifest.yaml in the channel.","triggerScenarios":"Thrown at pkg/wellknownoperators/operators.go:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set spec.version to a concrete version string on every ClusterPackage object","Verify the ClusterPackage object's YAML types (version must be a quoted string, not a number)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}