{"record":{"id":"72e0d0c426776cb7","repo":"oauth2-proxy/oauth2-proxy","slug":"error-unmarshalling-config-w","errorCode":null,"errorMessage":"error unmarshalling config: %w","messagePattern":"error unmarshalling config: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/options/load.go","lineNumber":52,"sourceCode":"\n\tif configFileName != \"\" {\n\t\terr := v.ReadInConfig()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to load config file: %w\", err)\n\t\t}\n\t}\n\n\terr := registerFlags(v, \"\", flagSet, into)\n\tif err != nil {\n\t\t// This should only happen if there is a programming error\n\t\treturn fmt.Errorf(\"unable to register flags: %w\", err)\n\t}\n\n\t// UnmarshalExact will return an error if the config includes options that are\n\t// not mapped to fields of the into struct\n\terr = v.UnmarshalExact(into, decodeFromCfgTag)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error unmarshalling config: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// LoadYAML will load a YAML based configuration file into the options interface provided.\nfunc LoadYAML(configFileName string, opts interface{}) error {\n\tbuffer, err := loadAndSubstituteEnvs(configFileName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Generic interface for loading arbitrary yaml structure\n\tvar intermediate map[string]interface{}\n\n\tif err := yaml.Unmarshal(buffer, &intermediate); err != nil {\n\t\treturn fmt.Errorf(\"error unmarshalling config: %w\", err)\n\t}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/oauth2-proxy/oauth2-proxy/blob/33c2eb92dea78204f7a18bc2dfdbccc220f39257/pkg/apis/options/load.go#L34-L70","documentation":"Wrap error in options.Load: viper's UnmarshalExact failed while mapping config file/flags onto the options struct. Because ErrorUnused is in effect, this commonly means the config contains a key that does not map to any option, or a value has the wrong type for its field.","triggerScenarios":"Thrown at pkg/apis/options/load.go:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Find the offending key in the error detail and correct or remove it","Check spelling and nesting of the option in the config file","Ensure values match the expected types (strings, durations, byte sizes)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"33c2eb92dea78204f7a18bc2dfdbccc220f39257","analyzedAt":"2026-09-06T08:51:53.077Z","contentChangedAt":"2026-09-06T08:51:53.077Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}