kataras/iris · error

default configuration file '" + filename + "' does not exist

Error message

default configuration file '" + filename + "' does not exist

What it means

iris.YAML loads the global Iris configuration from a YAML file. If the special global keyword ("iris.yml"-style global configuration) is used and the home-directory config file does not exist, it panics because it refuses to silently fall back to defaults when the user explicitly requested the global file.

Source

Thrown at configuration.go:99

//
// Accepts the absolute path of the cfg.yml.
// An error will be shown to the user via panic with the error message.
// Error may occur when the cfg.yml 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.yml,
// see `WithGlobalConfiguration` for more information.
//
// Usage:
// app.Configure(iris.WithConfiguration(iris.YAML("myconfig.yml"))) or
// app.Run([iris.Runner], iris.WithConfiguration(iris.YAML("myconfig.yml"))).
func YAML(filename string) Configuration {
	// check for globe configuration file and use that, otherwise
	// return the default configuration if file doesn't exist.
	if filename == globalConfigurationKeyword {
		filename = homeConfigurationFilename(".yml")
		if _, err := os.Stat(filename); os.IsNotExist(err) {
			panic("default configuration file '" + filename + "' does not exist")
		}
	}

	c, err := parseYAML(filename)
	if err != nil {
		panic(err)
	}

	return c
}

// TOML reads Configuration from a toml-compatible document file.
// Read more about toml's implementation at:
// https://github.com/toml-lang/toml
//
// Accepts the absolute path of the configuration file.
// 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.

View on GitHub (pinned to 7bedaf55a0)

Solutions

  1. Create the expected global configuration file at the path shown in the panic message (~/.iris.yml).
  2. Pass an explicit existing YAML file path instead of the global keyword.
  3. Set the HOME environment correctly or ship the config with the application and reference it directly.

Example fix

// before
conf := iris.YAML("iris.yml") // global lookup, panics if ~/.iris.yml missing
// after
conf := iris.YAML("/etc/myapp/iris.yml") // explicit existing file
Defensive patterns

Strategy: validation

Validate before calling

p := homeConfigurationFilename(".yml") // e.g. ~/.iris.yml
if _, err := os.Stat(p); os.IsNotExist(err) {
  log.Fatalf("global config missing: %s", p)
}
conf := iris.YAML("iris.yml")

Prevention

When it happens

Trigger: Calling configuration.YAML with the globalConfigurationKeyword (e.g. "iris.yml") when the computed home configuration file (~/.iris.yml) does not exist on disk.

Common situations: Deploying to servers/containers where the developer's home-dir iris.yml was never copied; CI environments with fresh HOME directories; switching users so HOME points elsewhere.

Related errors


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