1Panel-dev/1Panel · error

fatal error config file: %s

Error message

fatal error config file: %s

What it means

Error "fatal error config file: %s" thrown in 1Panel-dev/1Panel.

Source

Thrown at core/init/viper/viper.go:38

	mode := ""
	version := "v2.0.0"
	username, password, entrance, language, edition := "", "", "", "zh", ""
	v := viper.NewWithOptions()
	v.SetConfigType("yaml")

	config := global.ServerConfig{}
	if err := yaml.Unmarshal(conf.AppYaml, &config); err != nil {
		panic(err)
	}
	if config.Base.Mode != "" {
		mode = config.Base.Mode
	}
	_, err := os.Stat("/opt/1panel/conf/app.yaml")
	if mode == "dev" && err == nil {
		v.SetConfigName("app")
		v.AddConfigPath(path.Join("/opt/1panel/conf"))
		if err := v.ReadInConfig(); err != nil {
			panic(fmt.Errorf("fatal error config file: %s", err))
		}
	} else {
		baseDir = ctl_conf.Load("BASE_DIR")
		port = ctl_conf.Load("ORIGINAL_PORT")
		version = ctl_conf.Load("ORIGINAL_VERSION")
		username = ctl_conf.Load("ORIGINAL_USERNAME")
		password = ctl_conf.Load("ORIGINAL_PASSWORD")
		entrance = ctl_conf.Load("ORIGINAL_ENTRANCE")
		language = ctl_conf.Load("LANGUAGE")
		edition = ctl_conf.LoadWithoutPanic("PANEL_EDITION")

		reader := bytes.NewReader(conf.AppYaml)
		if err := v.ReadConfig(reader); err != nil {
			panic(fmt.Errorf("fatal error config file: %s", err))
		}
	}
	v.OnConfigChange(func(e fsnotify.Event) {
		if err := v.Unmarshal(&global.CONF); err != nil {

View on GitHub (pinned to 5ac7c80881)

Solutions

  1. Verify that /opt/1panel/conf/app.yaml exists and is readable by the 1Panel core process.
  2. Validate the YAML syntax of app.yaml (e.g. with `yamllint` or `python -c 'import yaml;yaml.safe_load(open("/opt/1panel/conf/app.yaml"))'`) and fix any parse errors.
  3. If the file is corrupted, restore app.yaml from a backup or reinstall 1Panel to regenerate the default configuration.
  4. Check file permissions and ownership on /opt/1panel/conf/app.yaml so the service user can read it.

Example fix

yaml.safe_load(open('/opt/1panel/conf/app.yaml'))  # find the syntax error, fix it, then restart: systemctl restart 1panel

When it happens

Trigger: Thrown at core/init/viper/viper.go:38 when the library encounters an invalid state.

Common situations: Occurs at core startup when running in dev mode and /opt/1panel/conf/app.yaml exists but cannot be parsed by viper (malformed YAML, wrong permissions, or unreadable file). The process panics via fmt.Errorf; there is no recovery path. Defense: validate app.yaml syntax before restart, keep file permissions readable only by the service user, and treat this panic as a fatal configuration error requiring operator intervention rather than an automatic retry.


AI-assisted analysis of 1Panel-dev/1Panel@5ac7c80881 (2026-08-15). Data as JSON: /api/errors/da4e980ee8b4df47. Report an issue: GitHub.