fatedier/frp · error

load additional config from %s error: %v

Error message

load additional config from %s error: %v

What it means

In the new-format client config loader, each glob under includes is expanded and every matched file is loaded as a full v1.ClientConfig via LoadConfigureFromFile (yaml/json/toml all supported). Any decode/validation failure in one included file aborts with 'load additional config from <absFile> error: <cause>', naming the offending file.

Source

Thrown at pkg/config/load.go:526

			return nil, nil, err
		}
		if _, err := os.Stat(absDir); os.IsNotExist(err) {
			return nil, nil, err
		}
		files, err := os.ReadDir(absDir)
		if err != nil {
			return nil, nil, err
		}
		for _, fi := range files {
			if fi.IsDir() {
				continue
			}
			absFile := filepath.Join(absDir, fi.Name())
			if matched, _ := filepath.Match(filepath.Join(absDir, filepath.Base(path)), absFile); matched {
				// support yaml/json/toml
				cfg := v1.ClientConfig{}
				if err := LoadConfigureFromFile(absFile, &cfg, strict); err != nil {
					return nil, nil, fmt.Errorf("load additional config from %s error: %v", absFile, err)
				}
				for _, c := range cfg.Proxies {
					proxyCfgs = append(proxyCfgs, c.ProxyConfigurer)
				}
				for _, c := range cfg.Visitors {
					visitorCfgs = append(visitorCfgs, c.VisitorConfigurer)
				}
			}
		}
	}
	return proxyCfgs, visitorCfgs, nil
}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Open the named file and fix the wrapped error (usually a syntax or type error)
  2. Narrow the include glob so only intended files match (exclude .bak/.swp)
  3. Run frpc verify after fixing to validate the merged view

Example fix

# before (/etc/frp/conf/db.toml has: bindPort = "3306")
# after (in /etc/frp/conf/db.toml)
bindPort = 3306
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-load every included file standalone
for _, f := range expandedIncludeFiles {
    tmp := v1.ClientConfig{}
    if err := config.LoadConfigureFromFile(f, &tmp, strict); err != nil { return fmt.Errorf("include %s invalid: %w", f, err) }
}

Try / catch

if _, _, err := config.LoadClientConfigWithIncludes(...); err != nil { if i := strings.Index(err.Error(), "load additional config from "); i >= 0 { /* substring names the broken file; fix only that file */ } }

Prevention

When it happens

Trigger: frpc.toml with includes = ["/etc/frp/conf/*.toml"] where one matched file has a TOML syntax error, a wrong-typed field, an unknown proxy type, or cannot be parsed at all; the wrapper names exactly which file failed.

Common situations: Splitting proxy definitions into per-service files; one broken fragment (typo, bad type) taking down the whole frpc start; editor temp files matching the glob.

Related errors


AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15). Data as JSON: /api/errors/73e2ec9ff3e53faf. Report an issue: GitHub.