kataras/iris · error

default configuration file '<filename>' does not exist

Error message

default configuration file '<filename>' does not exist

What it means

iris.TOML loads the global Iris configuration from a TOML file. When the global configuration keyword is passed, it resolves to a home-directory .tml file and panics if that file does not exist, mirroring the YAML behavior.

Source

Thrown at configuration.go:134

// An error will be shown to the user via panic with the error message.
// Error may occur when the file does not exist or is not formatted correctly.
//
// Note: if the char '~' passed as "filename" then it tries to load and return
// the configuration from the $home_directory + iris.tml,
// see `WithGlobalConfiguration` for more information.
//
// Usage:
// app.Configure(iris.WithConfiguration(iris.TOML("myconfig.tml"))) or
// app.Run([iris.Runner], iris.WithConfiguration(iris.TOML("myconfig.tml"))).
func TOML(filename string) Configuration {
	c := DefaultConfiguration()

	// check for globe configuration file and use that, otherwise
	// return the default configuration if file doesn't exist.
	if filename == globalConfigurationKeyword {
		filename = homeConfigurationFilename(".tml")
		if _, err := os.Stat(filename); os.IsNotExist(err) {
			panic("default configuration file '" + filename + "' does not exist")
		}
	}

	// get the abs
	// which will try to find the 'filename' from current workind dir too.
	tomlAbsPath, err := filepath.Abs(filename)
	if err != nil {
		panic(fmt.Errorf("toml: %w", err))
	}

	// read the raw contents of the file
	data, err := os.ReadFile(tomlAbsPath)
	if err != nil {
		panic(fmt.Errorf("toml :%w", err))
	}

	// put the file's contents as toml to the default configuration(c)
	if _, err := toml.Decode(string(data), &c); err != nil {

View on GitHub (pinned to 7bedaf55a0)

Solutions

  1. Create the TOML file at the path named in the panic message.
  2. Pass an explicit existing TOML file path instead of the global keyword.
  3. Ensure HOME is set to the directory containing iris.tml.

Example fix

// before
conf := iris.TOML("iris.tml") // global lookup
// after
conf := iris.TOML("/etc/myapp/iris.tml")
Defensive patterns

Strategy: validation

Validate before calling

p := filepath.Join(os.Getenv("HOME"), ".iris.tml")
if _, err := os.Stat(p); os.IsNotExist(err) {
  log.Fatalf("global TOML config missing: %s", p)
}
conf := iris.TOML("iris.tml")

Prevention

When it happens

Trigger: Calling configuration.TOML with the globalConfigurationKeyword when the computed home TOML config file (~/.iris.tml) does not exist, raised in TestConfigurationTOML-style usage.

Common situations: Fresh machines or CI containers lacking the home-dir iris.tml, wrong HOME, or assuming TOML global config exists because the YAML one does.

Related errors


AI-assisted analysis of kataras/iris@7bedaf55a0 (2026-08-30). Data as JSON: /api/errors/f6ba8c5640abb96f. Report an issue: GitHub.