{"record":{"id":"9f085667c8a52db4","repo":"cilium/cilium","slug":"type-is-unknown-s","errorCode":null,"errorMessage":"type is unknown: %s","messagePattern":"type is unknown: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/clustermesh/mcsapi/types/mcsapiservicespec.go","lineNumber":152,"sourceCode":"\t}\n\n\t*s = newMCSAPIServiceSpec\n\n\treturn nil\n}\n\nfunc (s *MCSAPIServiceSpec) validate() error {\n\tswitch {\n\tcase s.Cluster == \"\":\n\t\treturn errors.New(\"cluster is unset\")\n\tcase s.Namespace == \"\":\n\t\treturn errors.New(\"namespace is unset\")\n\tcase s.Name == \"\":\n\t\treturn errors.New(\"name is unset\")\n\tcase s.ExportCreationTimestamp.IsZero():\n\t\treturn errors.New(\"exportCreationTimestamp is unset\")\n\tcase s.Type != mcsapiv1beta1.ClusterSetIP && s.Type != mcsapiv1beta1.Headless:\n\t\treturn fmt.Errorf(\"type is unknown: %s\", s.Type)\n\tcase s.SessionAffinity != corev1.ServiceAffinityClientIP && s.SessionAffinity != corev1.ServiceAffinityNone:\n\t\treturn fmt.Errorf(\"session affinity is unknown: %s\", s.SessionAffinity)\n\tcase s.InternalTrafficPolicy != nil &&\n\t\t*s.InternalTrafficPolicy != corev1.ServiceInternalTrafficPolicyCluster &&\n\t\t*s.InternalTrafficPolicy != corev1.ServiceInternalTrafficPolicyLocal:\n\t\treturn fmt.Errorf(\"internal traffic policy is unknown: %s\", *s.InternalTrafficPolicy)\n\tcase s.TrafficDistribution != nil &&\n\t\t*s.TrafficDistribution != corev1.ServiceTrafficDistributionPreferClose &&\n\t\t*s.TrafficDistribution != corev1.ServiceTrafficDistributionPreferSameZone &&\n\t\t*s.TrafficDistribution != corev1.ServiceTrafficDistributionPreferSameNode:\n\t\treturn fmt.Errorf(\"traffic distribution is unknown: %s\", *s.TrafficDistribution)\n\t}\n\n\treturn nil\n}\n\n// ValidatingMCSAPIServiceSpec wraps a MCSAPIServiceSpec to perform additional\n// validation at unmarshal time.","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/clustermesh/mcsapi/types/mcsapiservicespec.go#L134-L170","documentation":"validate() checks a MCSAPIServiceSpec deserialized from the kvstore; a spec whose Service type is neither ClusterSetIP nor Headless is rejected with this error. It fires during Unmarshal when remote-synced MCS API data is corrupted or from an incompatible writer version.","triggerScenarios":"Unmarshal of a stored/kvstore-encoded MCSAPIServiceSpec whose .Type field holds any value other than mcsapiv1beta1.ClusterSetIP or mcsapiv1beta1.Headless (empty string, \"LoadBalancer\", \"NodePort\", etc.).","commonSituations":"Version skew: an older/newer cilium agent or another tool wrote an unsupported Service type into the backing store; manual edits of stored objects; partial/corrupted kvstore entries.","solutions":["Inspect the offending kvstore entry and fix or delete it so it is re-exported with a valid type","Align cilium agent versions across clusters so the exporter writes only ClusterSetIP/Headless types","Regenerate the MCS API ServiceExport/Service on the source cluster","Report upstream if a supported type is being rejected"],"exampleFix":"// before (in stored spec JSON)\n\"type\": \"LoadBalancer\"\n// after\n\"type\": \"ClusterSetIP\"","handlingStrategy":"validation","validationCode":"if spec.Type != mcsapiv1beta1.ClusterSetIP && spec.Type != mcsapiv1beta1.Headless {\n    return fmt.Errorf(\"unsupported service type %q before sync\", spec.Type)\n}","typeGuard":"func validMCSType(t mcsapiv1beta1.ServiceType) bool {\n    return t == mcsapiv1beta1.ClusterSetIP || t == mcsapiv1beta1.Headless\n}","tryCatchPattern":"spec, err := types.UnmarshalMCServiceSpec(key, data, validators...)\nif err != nil {\n    log.WithError(err).Warn(\"dropping invalid mcsapi spec; will re-sync\")\n    return nil // skip entry\n}","preventionTips":["Validate the source Service type before exporting","Keep cilium versions aligned across clusters","Never hand-edit kvstore entries","Alert on Unmarshal failures in clustermesh logs"],"tags":["clustermesh","mcsapi","validation","kvstore"],"backgroundTag":"schema-validation-failed","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}