ory/hydra · error

unknown config file extension: %s

Error message

unknown config file extension: %s

What it means

Returned by NewKoanfFileSubKey when the config file's extension is not .toml, .json, .yaml or .yml, so no parser can be selected. The file path itself is at fault — its extension names an unsupported configuration format.

Source

Thrown at oryx/configx/koanf_file.go:48

func NewKoanfFile(path string) (*KoanfFile, error) {
	return NewKoanfFileSubKey(path, "")
}

func NewKoanfFileSubKey(path, subKey string) (*KoanfFile, error) {
	kf := &KoanfFile{
		path:   filepath.Clean(path),
		subKey: subKey,
	}

	switch e := filepath.Ext(path); e {
	case ".toml":
		kf.parser = toml.Parser()
	case ".json":
		kf.parser = json.Parser()
	case ".yaml", ".yml":
		kf.parser = yaml.Parser()
	default:
		return nil, errors.Errorf("unknown config file extension: %s", e)
	}

	return kf, nil
}

// ReadBytes is not supported by KoanfFile.
func (f *KoanfFile) ReadBytes() ([]byte, error) {
	return nil, errors.New("file provider does not support this method")
}

// Read reads the file and returns the parsed configuration.
func (f *KoanfFile) Read() (map[string]interface{}, error) {
	//#nosec G304 -- false positive
	fc, err := os.ReadFile(f.path)
	if err != nil {
		return nil, errors.WithStack(err)
	}

View on GitHub (pinned to 4174065ffb)

Solutions

  1. Rename the file to use a supported extension: .toml, .json, .yaml, or .yml
  2. Convert the configuration to one of the supported formats
  3. Check for typos in the path, e.g. a trailing dot or missing extension
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at oryx/configx/koanf_file.go:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ory/hydra@4174065ffb (2026-09-03). Data as JSON: /api/errors/6c6a57df4363133f. Report an issue: GitHub.