{"record":{"id":"46f2c89b17e5e4b6","repo":"kubernetes/kubernetes","slug":"invalid-feature-name-q-must-be-no-more-than-d-c","errorCode":null,"errorMessage":"invalid feature name %q: must be no more than %d characters","messagePattern":"invalid feature name %q: must be no more than (.+?) characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/core/validation/validation.go","lineNumber":7578,"sourceCode":"}\n\nfunc ValidateNodeSpecificAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\tif annotations[core.TaintsAnnotationKey] != \"\" {\n\t\tallErrs = append(allErrs, ValidateTaintsInNodeAnnotations(annotations, fldPath)...)\n\t}\n\n\tif annotations[core.PreferAvoidPodsAnnotationKey] != \"\" {\n\t\tallErrs = append(allErrs, ValidateAvoidPodsInNodeAnnotations(annotations, fldPath)...)\n\t}\n\treturn allErrs\n}\n\n// validateNodeDeclaredFeatureName checks if a declared feature name is valid.\nfunc validateNodeDeclaredFeatureName(featureName string) error {\n\tif len(featureName) > validation.DNS1123SubdomainMaxLength {\n\t\treturn fmt.Errorf(\"invalid feature name %q: must be no more than %d characters\", featureName, validation.DNS1123SubdomainMaxLength)\n\t}\n\tif !nodeDeclaredFeatureRegexp.MatchString(featureName) {\n\t\treturn fmt.Errorf(\"invalid feature name %q: must start with an UpperCamelCase segment, with subsequent segments separated by '/' (e.g., MyFeature or MyFeature/mySubFeature), and contain only alphanumeric characters and slashes\", featureName)\n\t}\n\treturn nil\n}\n\nfunc validateNodeDeclaredFeatures(nodeFeatures []string, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\t// We do not need to check feature gate again here as we do it in dropDisabledFields() (pkg/registry/core/node/strategy.go)\n\tfeatureCount := len(nodeFeatures)\n\tfor i, feature := range nodeFeatures {\n\t\tif err := validateNodeDeclaredFeatureName(feature); err != nil {\n\t\t\tallErrs = append(allErrs, field.Invalid(fldPath.Index(i), feature, err.Error()))\n\t\t}\n\t\tif i+1 < featureCount {\n\t\t\tnextFeature := nodeFeatures[i+1]\n\t\t\tif feature == nextFeature {","sourceCodeStart":7560,"sourceCodeEnd":7596,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/pkg/apis/core/validation/validation.go#L7560-L7596","documentation":"Thrown by validateNodeDeclaredFeatureName while validating node.spec.declaredFeatures entries. Each feature name must be no longer than validation.DNS1123SubdomainMaxLength (253 characters). The library enforces this cap so feature names stay compatible with Kubernetes label/subdomain constraints downstream.","triggerScenarios":"Submitting or updating a Node object whose spec.declaredFeatures array contains a string longer than 253 characters.","commonSituations":"A device plugin or node-feature-discovery style component synthesizes extremely long feature identifiers; concatenated namespace strings; copy-paste of a full path into the feature list.","solutions":["Shorten the offending feature name to 253 characters or fewer.","Split one oversized feature into several shorter, hierarchical entries (using '/' separators within the format rules).","Check the generator/template producing the declaredFeatures list and cap the identifier length at the source."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const maxFeatureLen = 253 // validation.DNS1123SubdomainMaxLength\nif len(featureName) > maxFeatureLen {\n    // reject / truncate / split before setting spec.declaredFeatures\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cap generated feature identifiers at the source.","Unit-test the component that populates node.spec.declaredFeatures against the 253-char limit."],"tags":["node","features","validation","declared-features"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}