fatedier/frp · error

invalid proxy config

Error message

invalid proxy config

What it means

validateStoreProxyConfigurer rejects a nil ProxyConfigurer (or a config whose Clone() returns nil) before validation runs. In practice reached through CreateStoreProxy/UpdateStoreProxy where the decoded body produced a nil configurer — e.g. an unknown proxy type in the JSON payload. Surfaces as 'invalid argument: validation error: invalid proxy config' to the caller.

Source

Thrown at client/config_manager.go:444

	}

	if err := fn(storeSource); err != nil {
		return nil, err
	}
	if err := m.svr.reloadConfigFromSourcesLocked(); err != nil {
		return nil, fmt.Errorf("%w: failed to apply config: %v", configmgmt.ErrApplyConfig, err)
	}

	persisted := storeSource.GetVisitor(name)
	if persisted == nil {
		return nil, fmt.Errorf("%w: visitor %q not found in store after mutation", configmgmt.ErrApplyConfig, name)
	}
	return persisted.Clone(), nil
}

func (m *serviceConfigManager) validateStoreProxyConfigurer(cfg v1.ProxyConfigurer) error {
	if cfg == nil {
		return fmt.Errorf("invalid proxy config")
	}
	runtimeCfg := cfg.Clone()
	if runtimeCfg == nil {
		return fmt.Errorf("invalid proxy config")
	}
	runtimeCfg.Complete()
	return validation.ValidateProxyConfigurerForClient(runtimeCfg)
}

func (m *serviceConfigManager) validateStoreVisitorConfigurer(cfg v1.VisitorConfigurer) error {
	if cfg == nil {
		return fmt.Errorf("invalid visitor config")
	}
	runtimeCfg := cfg.Clone()
	if runtimeCfg == nil {
		return fmt.Errorf("invalid visitor config")
	}
	runtimeCfg.Complete()

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Set a valid type in the body (one of tcp, udp, http, https, stcp, sudp, xtcp, tcpmux)
  2. Confirm you are posting to /api/config/proxies and not the visitors endpoint
  3. Check the frp version supports that proxy type

Example fix

// before
{"type": "tcp-proxy", "name": "p1", ...}

// after
{"type": "tcp", "name": "p1", "localPort": 22, "remotePort": 6022}
Defensive patterns

Strategy: type-guard

Validate before calling

func knownProxyType(t string) bool {
	switch t {
	case "tcp", "udp", "http", "https", "stcp", "sudp", "xtcp", "tcpmux":
		return true
	}
	return false
}

Type guard

func isValidProxyBody(body []byte) bool {
	var p struct{ Type string `json:"type"` }
	if json.Unmarshal(body, &p) != nil {
		return false
	}
	return knownProxyType(p.Type)
}

Prevention

When it happens

Trigger: POST/PUT /api/config/proxies with a JSON body whose type field is not a known proxy type (tcp/udp/http/https/stcp/sudp/xtcp/tcpmux), so decoding yields a nil configurer; or an empty body.

Common situations: Typos in the type field; sending a visitor config to the proxy endpoint; version mismatch where the server build lacks a newer proxy type.

Related errors


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