{"record":{"id":"8ffb011b5ad9437e","repo":"kataras/iris","slug":"default-configuration-file-filename-does","errorCode":null,"errorMessage":"default configuration file '\" + filename + \"' does not exist","messagePattern":"default configuration file '\" \\+ filename \\+ \"' does not exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"configuration.go","lineNumber":99,"sourceCode":"//\n// Accepts the absolute path of the cfg.yml.\n// An error will be shown to the user via panic with the error message.\n// Error may occur when the cfg.yml does not exist or is not formatted correctly.\n//\n// Note: if the char '~' passed as \"filename\" then it tries to load and return\n// the configuration from the $home_directory + iris.yml,\n// see `WithGlobalConfiguration` for more information.\n//\n// Usage:\n// app.Configure(iris.WithConfiguration(iris.YAML(\"myconfig.yml\"))) or\n// app.Run([iris.Runner], iris.WithConfiguration(iris.YAML(\"myconfig.yml\"))).\nfunc YAML(filename string) Configuration {\n\t// check for globe configuration file and use that, otherwise\n\t// return the default configuration if file doesn't exist.\n\tif filename == globalConfigurationKeyword {\n\t\tfilename = homeConfigurationFilename(\".yml\")\n\t\tif _, err := os.Stat(filename); os.IsNotExist(err) {\n\t\t\tpanic(\"default configuration file '\" + filename + \"' does not exist\")\n\t\t}\n\t}\n\n\tc, err := parseYAML(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn c\n}\n\n// TOML reads Configuration from a toml-compatible document file.\n// Read more about toml's implementation at:\n// https://github.com/toml-lang/toml\n//\n// Accepts the absolute path of the configuration file.\n// An error will be shown to the user via panic with the error message.\n// Error may occur when the file does not exist or is not formatted correctly.","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/configuration.go#L81-L117","documentation":"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.","triggerScenarios":"Calling configuration.YAML with the globalConfigurationKeyword (e.g. \"iris.yml\") when the computed home configuration file (~/.iris.yml) does not exist on disk.","commonSituations":"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.","solutions":["Create the expected global configuration file at the path shown in the panic message (~/.iris.yml).","Pass an explicit existing YAML file path instead of the global keyword.","Set the HOME environment correctly or ship the config with the application and reference it directly."],"exampleFix":"// before\nconf := iris.YAML(\"iris.yml\") // global lookup, panics if ~/.iris.yml missing\n// after\nconf := iris.YAML(\"/etc/myapp/iris.yml\") // explicit existing file","handlingStrategy":"validation","validationCode":"p := homeConfigurationFilename(\".yml\") // e.g. ~/.iris.yml\nif _, err := os.Stat(p); os.IsNotExist(err) {\n  log.Fatalf(\"global config missing: %s\", p)\n}\nconf := iris.YAML(\"iris.yml\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ship an explicit config file path with the app instead of relying on the home-dir global file","Ensure HOME is set correctly in containers/CI","Create ~/.iris.yml as part of deployment provisioning"],"tags":["go","panic","config","file-not-found"],"backgroundTag":"default-config-file-missing","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}