{"record":{"id":"dd0f8340003f2dbf","repo":"vitessio/vitess","slug":"unknown-handling-name-s","errorCode":null,"errorMessage":"unknown handling name %s","messagePattern":"unknown handling name (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/viperutil/config.go","lineNumber":293,"sourceCode":"\thandlingNames = make([]string, 0, len(handlingNamesToValues))\n\thandlingValuesToNames = make(map[int]string, len(handlingNamesToValues))\n\n\tfor name, val := range handlingNamesToValues {\n\t\thandlingValuesToNames[val] = name\n\t\thandlingNames = append(handlingNames, name)\n\t}\n\n\tslices.Sort(handlingNames)\n}\n\nfunc (h *ConfigFileNotFoundHandling) Set(arg string) error {\n\tlarg := strings.ToLower(arg)\n\tif v, ok := handlingNamesToValues[larg]; ok {\n\t\t*h = ConfigFileNotFoundHandling(v)\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"unknown handling name %s\", arg)\n}\n\nfunc (h *ConfigFileNotFoundHandling) String() string {\n\tif name, ok := handlingValuesToNames[int(*h)]; ok {\n\t\treturn name\n\t}\n\n\treturn \"<UNKNOWN>\"\n}\n\nfunc (h *ConfigFileNotFoundHandling) Type() string { return \"ConfigFileNotFoundHandling\" }\n","sourceCodeStart":275,"sourceCodeEnd":305,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/viperutil/config.go#L275-L305","documentation":"This error is returned by (*ConfigFileNotFoundHandling).Set in go/viperutil when a caller supplies a string that is not a recognized name for how to handle a missing config file. The Set method looks the lowercased argument up in handlingNamesToValues; if the key is absent, it rejects the value with this error. It exists to keep the handling enum closed — only documented names (e.g. the registered handling names) are accepted.","triggerScenarios":"Calling Set (directly or via viper/decoder wiring in decodeHandlingValue) with a misspelled or unsupported string such as \"Stop\" vs \"stop\", \"ingore\", \"fail\", or an entirely invented mode name.","commonSituations":"Typos in config files or flag/env values for ConfigFileNotFoundHandling; users copying an option name from an older or newer Vitess version where the accepted names differ; case-sensitivity confusion (input is lowercased, so case is fine — the spelling is the problem).","solutions":["Check the value in your config file/flag and correct the spelling to one of the names registered in handlingNamesToValues (see the String/Set code in go/viperutil/config.go for the accepted list).","Consult the docs or `--help` output for the valid ConfigFileNotFoundHandling options in your Vitess version.","If a new handling mode is genuinely needed, add a mapping to handlingNamesToValues and the corresponding handlingValuesToNames entry rather than passing an arbitrary string."],"exampleFix":"// before (config.yaml)\nconfig_file_not_found: StopOnMissing\n// after\nconfig_file_not_found: stop","handlingStrategy":"validation","validationCode":"validHandlingNames := []string{\"ignore\", \"warn\", \"error\"} // check handlingNamesToValues in go/viperutil/config.go\nif !slices.Contains(validHandlingNames, strings.ToLower(val)) {\n\treturn fmt.Errorf(\"%q is not a valid ConfigFileNotFoundHandling name; expected one of %v\", val, validHandlingNames)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep handling values in one place (a config struct), never hardcoded strings scattered in configs.","Validate config at startup with a schema/enum check before viper decodes it.","Copy option names from the version's documentation, not from memory or other versions."],"tags":["config","validation","viper"],"backgroundTag":"invalid-enum-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}