{"record":{"id":"f6ba8c5640abb96f","repo":"kataras/iris","slug":"default-configuration-file-filename-does-not-e","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":134,"sourceCode":"// 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.\n//\n// Note: if the char '~' passed as \"filename\" then it tries to load and return\n// the configuration from the $home_directory + iris.tml,\n// see `WithGlobalConfiguration` for more information.\n//\n// Usage:\n// app.Configure(iris.WithConfiguration(iris.TOML(\"myconfig.tml\"))) or\n// app.Run([iris.Runner], iris.WithConfiguration(iris.TOML(\"myconfig.tml\"))).\nfunc TOML(filename string) Configuration {\n\tc := DefaultConfiguration()\n\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(\".tml\")\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\t// get the abs\n\t// which will try to find the 'filename' from current workind dir too.\n\ttomlAbsPath, err := filepath.Abs(filename)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"toml: %w\", err))\n\t}\n\n\t// read the raw contents of the file\n\tdata, err := os.ReadFile(tomlAbsPath)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"toml :%w\", err))\n\t}\n\n\t// put the file's contents as toml to the default configuration(c)\n\tif _, err := toml.Decode(string(data), &c); err != nil {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/configuration.go#L116-L152","documentation":"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.","triggerScenarios":"Calling configuration.TOML with the globalConfigurationKeyword when the computed home TOML config file (~/.iris.tml) does not exist, raised in TestConfigurationTOML-style usage.","commonSituations":"Fresh machines or CI containers lacking the home-dir iris.tml, wrong HOME, or assuming TOML global config exists because the YAML one does.","solutions":["Create the TOML file at the path named in the panic message.","Pass an explicit existing TOML file path instead of the global keyword.","Ensure HOME is set to the directory containing iris.tml."],"exampleFix":"// before\nconf := iris.TOML(\"iris.tml\") // global lookup\n// after\nconf := iris.TOML(\"/etc/myapp/iris.tml\")","handlingStrategy":"validation","validationCode":"p := filepath.Join(os.Getenv(\"HOME\"), \".iris.tml\")\nif _, err := os.Stat(p); os.IsNotExist(err) {\n  log.Fatalf(\"global TOML config missing: %s\", p)\n}\nconf := iris.TOML(\"iris.tml\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass an explicit existing .tml path instead of the global keyword","Provision the home TOML config in Docker/CI images","Verify HOME points to the expected user"],"tags":["go","panic","config","toml","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"}