oauth2-proxy/oauth2-proxy · error
error unmarshalling config: %w
Error message
error unmarshalling config: %w
What it means
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.
Source
Thrown at pkg/apis/options/load.go:52
if configFileName != "" {
err := v.ReadInConfig()
if err != nil {
return fmt.Errorf("unable to load config file: %w", err)
}
}
err := registerFlags(v, "", flagSet, into)
if err != nil {
// This should only happen if there is a programming error
return fmt.Errorf("unable to register flags: %w", err)
}
// UnmarshalExact will return an error if the config includes options that are
// not mapped to fields of the into struct
err = v.UnmarshalExact(into, decodeFromCfgTag)
if err != nil {
return fmt.Errorf("error unmarshalling config: %w", err)
}
return nil
}
// LoadYAML will load a YAML based configuration file into the options interface provided.
func LoadYAML(configFileName string, opts interface{}) error {
buffer, err := loadAndSubstituteEnvs(configFileName)
if err != nil {
return err
}
// Generic interface for loading arbitrary yaml structure
var intermediate map[string]interface{}
if err := yaml.Unmarshal(buffer, &intermediate); err != nil {
return fmt.Errorf("error unmarshalling config: %w", err)
}View on GitHub (pinned to 33c2eb92de)
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)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/apis/options/load.go:52 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oauth2-proxy/oauth2-proxy@33c2eb92de (2026-09-06).
Data as JSON: /api/errors/72e0d0c426776cb7.
Report an issue: GitHub.