fatedier/frp · warning

invalid extra payload

Error message

invalid extra payload

What it means

Emitted by parseClientAndProxyConfigurer when strings.Split(extraPayload, " ") yields fewer than one element. Since strings.Split never returns an empty slice, this branch is effectively defensive dead code — even an empty payload produces [""], which instead fails the proxy-type check. In practice you will see 'invalid proxy type' rather than this error.

Source

Thrown at pkg/ssh/server.go:271

		if addr != nil && extraPayload != "" {
			break
		}
	}
	return addr, extraPayload, nil
}

func (s *TunnelServer) parseClientAndProxyConfigurer(_ *tcpipForward, extraPayload string) (*v1.ClientCommonConfig, v1.ProxyConfigurer, string, error) {
	helpMessage := ""
	cmd := &cobra.Command{
		Use:   "ssh v0@{address} [command]",
		Short: "ssh v0@{address} [command]",
		Run:   func(*cobra.Command, []string) {},
	}
	cmd.SetGlobalNormalizationFunc(config.WordSepNormalizeFunc)

	args := strings.Split(extraPayload, " ")
	if len(args) < 1 {
		return nil, nil, helpMessage, fmt.Errorf("invalid extra payload")
	}
	proxyType := strings.TrimSpace(args[0])
	supportTypes := []string{"tcp", "http", "https", "tcpmux", "stcp"}
	if !slices.Contains(supportTypes, proxyType) {
		return nil, nil, helpMessage, fmt.Errorf("invalid proxy type: %s, support types: %v", proxyType, supportTypes)
	}
	pc := v1.NewProxyConfigurerByType(v1.ProxyType(proxyType))
	if pc == nil {
		return nil, nil, helpMessage, fmt.Errorf("new proxy configurer error")
	}
	config.RegisterProxyFlags(cmd, pc, config.WithSSHMode())

	clientCfg := v1.ClientCommonConfig{}
	config.RegisterClientCommonConfigFlags(cmd, &clientCfg, config.WithSSHMode())

	cmd.InitDefaultHelpCmd()
	if err := cmd.ParseFlags(args); err != nil {
		if errors.Is(err, flag.ErrHelp) {

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. If you hit it in a test harness, pass a non-empty payload string such as "tcp 127.0.0.1:22".
  2. If hit in production builds after local modification, review any changes to the args := strings.Split(...) line.
  3. Treat any occurrence as a code smell: the guard is unreachable with strings.Split semantics.
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Only reachable if a future refactor makes the args slice empty (e.g. switching to a splitter that can return zero fields). With the current code, no client input reaches it.

Common situations: None in released code; appears only when reading the source or writing tests that call parseClientAndProxyConfigurer directly with crafted inputs.

Related errors


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