{"record":{"id":"b06a25700e2b6cb2","repo":"GoogleContainerTools/skaffold","slug":"invalid-default-struct-tag-v-expected-key-value","errorCode":null,"errorMessage":"invalid default struct tag: %v, expected key=value","messagePattern":"invalid default struct tag: (.+?), expected key=value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/skaffold/yamltags/tags.go","lineNumber":206,"sourceCode":"\nfunc getOneOfSetsForStruct(structName string) map[string]fieldSet {\n\t_, ok := allOneOfs[structName]\n\tif !ok {\n\t\tallOneOfs[structName] = map[string]fieldSet{}\n\t}\n\treturn allOneOfs[structName]\n}\n\ntype oneOfTag struct {\n\tField     reflect.StructField\n\tParent    reflect.Value\n\toneOfSets map[string]fieldSet\n\tsetName   string\n}\n\nfunc (oot *oneOfTag) Load(s []string) error {\n\tif len(s) != 2 {\n\t\treturn fmt.Errorf(\"invalid default struct tag: %v, expected key=value\", s)\n\t}\n\toot.setName = s[1]\n\n\t// Fetch the right oneOfSet for the struct.\n\tstructName := oot.Parent.Type().Name()\n\toot.oneOfSets = getOneOfSetsForStruct(structName)\n\n\t// Add this field to the oneOfSet\n\tif _, ok := oot.oneOfSets[oot.setName]; !ok {\n\t\toot.oneOfSets[oot.setName] = fieldSet{}\n\t}\n\toot.oneOfSets[oot.setName][oot.Field.Name] = struct{}{}\n\treturn nil\n}\n\nfunc (oot *oneOfTag) Process(val reflect.Value) error {\n\tif isZeroValue(val) {\n\t\treturn nil","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/yamltags/tags.go#L188-L224","documentation":"oneOfTag.Load parses a `oneOf=groupName,defaultField` style struct tag; it expects exactly two tokens after splitting on '='. If the tag doesn't have the form key=value, Load returns 'invalid default struct tag: %v, expected key=value'. This is a compile-time-style misconfiguration in the struct definitions the config schemas rely on.","triggerScenarios":"A struct field's oneOf tag splits into a slice with len != 2 (e.g. `oneOf:\"deploy\"` with no default, extra '=', or stray whitespace), hit when the yamltags loader builds the tag during config struct loading/validation.","commonSituations":"Usually surfaced only when Skaffold's own config structs or a downstream project reusing pkg/skaffold/yamltags has a malformed tag; contributors adding new config fields typo the tag (missing default, `oneOf:\"oneOf:\"`, comma vs equals mixups).","solutions":["Fix the struct tag to the exact `oneOf=SetName=DefaultField` key=value form (split must yield 2 parts)","Check for stray '=' characters or trailing whitespace in the tag string","Compare the tag with a working example in pkg/skaffold/apm/verify/latest (existing oneOf usages)","If you only see this at runtime, rebuild/reinstall Skaffold from a clean source tree — you may have local edits"],"exampleFix":"// before (struct tag)\nDeploy `json:\"deploy\" yaml:\"deploy\" oneOf:\"deploy\"`   // splits to 1 part\n// after\nDeploy `json:\"deploy\" yaml:\"deploy\" oneOf=\"config=deploy\"`   // key=value","handlingStrategy":"validation","validationCode":"func validOneOfTag(tag string) bool {\n    parts := strings.Split(tag, \"=\")\n    return len(parts) == 2 && parts[0] != \"\" && parts[1] != \"\"\n}","typeGuard":"func hasOneOfTag(f reflect.StructField) (string, bool) {\n    t, ok := f.Tag.Lookup(\"oneOf\")\n    return t, ok && len(strings.Split(t, \"=\")) == 2\n}","tryCatchPattern":"if err := oot.Load(parts); err != nil {\n    // log full field/tag (reflect) and fail fast at config-load time\n}","preventionTips":["When adding oneOf struct tags, copy the exact key=value form from existing fields","Add a unit test that walks all config structs and validates tag arity at load","Search tags for stray '=' or whitespace before committing","Fail tag parsing during CI tests, not at user runtime"],"tags":["struct-tags","yamltags","developer-error"],"backgroundTag":"invalid-struct-tag","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}