fatedier/frp · critical

failed to load config from aggregator: %w

Error message

failed to load config from aggregator: %w

What it means

Returned by client.NewService (frpc startup) when ConfigSourceAggregator.Load() fails while gathering proxy/visitor configs from the configured sources (config file, and with aggregator setups, additional sources). The wrapped error identifies which source failed; frpc aborts creation before starting the web server or logging in.

Source

Thrown at client/service.go:182

	if err := setServiceOptionsDefault(&options); err != nil {
		return nil, err
	}

	authRuntime, err := auth.BuildClientAuth(&options.Common.Auth)
	if err != nil {
		return nil, err
	}

	if options.ConfigSourceAggregator == nil {
		return nil, fmt.Errorf("config source aggregator is required")
	}

	configSource := options.ConfigSourceAggregator.ConfigSource()
	storeSource := options.ConfigSourceAggregator.StoreSource()

	proxyCfgs, visitorCfgs, loadErr := options.ConfigSourceAggregator.Load()
	if loadErr != nil {
		return nil, fmt.Errorf("failed to load config from aggregator: %w", loadErr)
	}
	proxyCfgs, visitorCfgs = config.FilterClientConfigurers(options.Common, proxyCfgs, visitorCfgs)
	proxyCfgs = config.CompleteProxyConfigurers(proxyCfgs)
	visitorCfgs = config.CompleteVisitorConfigurers(visitorCfgs)

	// Create the web server after all fallible steps so its listener is not
	// leaked when an earlier error causes NewService to return.
	var webServer *httppkg.Server
	if options.Common.WebServer.Port > 0 {
		ws, err := httppkg.NewServer(options.Common.WebServer)
		if err != nil {
			return nil, err
		}
		webServer = ws
	}

	s := &Service{
		ctx:              context.Background(),

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Read the wrapped error — it names the failing source and underlying parse error.
  2. Validate the config file: frpc verify -c frpc.toml (or frpc check) to surface syntax problems.
  3. Fix any include paths / file permissions referenced by the aggregator.
  4. After edits, re-run verification before starting frpc.

Example fix

# before (frpc.toml) — broken quoting
auth.token = "abc

# after
auth.token = "abc"
Defensive patterns

Strategy: validation

Validate before calling

// CI / pre-deploy gate: parse the config before starting frpc
// (Go embedders)
if _, err := config.LoadConfigureWithType(path, "toml"); err != nil {
    return fmt.Errorf("refusing to start: config invalid: %w", err)
}

Try / catch

svc, err := client.NewService(options)
if err != nil && strings.Contains(err.Error(), "load config from aggregator") {
    // run `frpc verify -c frpc.toml`, fix reported syntax error, restart
}

Prevention

When it happens

Trigger: RunClient with a config file that fails to parse or load (bad TOML/YAML/JSON syntax, unreadable file path), or an included/watched source erroring during the initial Load call.

Common situations: Syntax error in frpc.toml (unterminated string, wrong bracket type); includes pointing at missing files; permission errors reading the config; env-var-expanded paths that resolve incorrectly.

Related errors


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