fatedier/frp · error

parse config error: %v

Error message

parse config error: %v

What it means

This is the wrapper error produced when the legacy INI client config passes initial parsing but fails ClientCommonConf.Validate — i.e. the real cause is one of the [common]-section validation errors (heartbeat ordering, invalid protocol, include problems) surfaced as 'parse config error: <cause>'. The %v embeds the specific validation message.

Source

Thrown at pkg/config/legacy/parse.go:44

	proxyCfgs map[string]ProxyConf,
	visitorCfgs map[string]VisitorConf,
	err error,
) {
	var content []byte
	content, err = GetRenderedConfFromFile(filePath)
	if err != nil {
		return
	}
	configBuffer := bytes.NewBuffer(nil)
	configBuffer.Write(content)

	// Parse common section.
	cfg, err = UnmarshalClientConfFromIni(content)
	if err != nil {
		return
	}
	if err = cfg.Validate(); err != nil {
		err = fmt.Errorf("parse config error: %v", err)
		return
	}

	// Aggregate proxy configs from include files.
	var buf []byte
	buf, err = getIncludeContents(cfg.IncludeConfigFiles)
	if err != nil {
		err = fmt.Errorf("getIncludeContents error: %v", err)
		return
	}
	configBuffer.WriteString("\n")
	configBuffer.Write(buf)

	// Parse all proxy and visitor configs.
	proxyCfgs, visitorCfgs, err = LoadAllProxyConfsFromIni(cfg.User, configBuffer.Bytes(), cfg.Start)
	if err != nil {
		return
	}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Read the suffix of the message after 'parse config error:' — it is the root cause (see the heartbeat/protocol/include errors)
  2. Fix the named field in the [common] section of frpc.ini
  3. Re-run frpc verify (frpc verify -c frpc.ini) to confirm validation passes

Example fix

# console: parse config error: invalid protocol
# before
[common]
protocol = http

# after
[common]
protocol = tcp
Defensive patterns

Strategy: try-catch

Validate before calling

// run ClientCommonConf.Validate() yourself before load
if err := commonConf.Validate(); err != nil {
    return fmt.Errorf("pre-flight validation failed: %w", err)
}

Try / catch

if err := legacy.LoadConfigure(path); err != nil {
    if idx := strings.Index(err.Error(), "parse config error: "); idx >= 0 {
        root := err.Error()[idx+len("parse config error: "):]
        // branch on root: heartbeat / protocol / include fixes
    }
    return err
}

Prevention

When it happens

Trigger: Calling the legacy client config load path (legacy INI frpc.ini with a [common] section) where Validate() returns an error: heartbeat_timeout < heartbeat_interval, protocol outside tcp/kcp/quic/websocket/wss, or an unresolvable/missing include directory.

Common situations: frpc fails at startup with 'parse config error: ...' — the tail of the message names the actual problem (e.g. 'parse config error: invalid protocol'). Common after hand-editing INI files or copying configs between environments.

Related errors


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