fatedier/frp · error · ErrInvalidArgument

invalid argument: proxy name is required

Error message

invalid argument: proxy name is required

What it means

Returned by GetStoreProxy when the name argument is the empty string. The store-proxy API identifies entries by name (GET /api/store/proxies/{name}), so an empty name is rejected up front with configmgmt.ErrInvalidArgument before the store source is even consulted.

Source

Thrown at client/config_manager.go:163

func (m *serviceConfigManager) StoreEnabled() bool {
	m.svr.reloadMu.Lock()
	storeSource := m.svr.storeSource
	m.svr.reloadMu.Unlock()
	return storeSource != nil
}

func (m *serviceConfigManager) ListStoreProxies() ([]v1.ProxyConfigurer, error) {
	storeSource, err := m.storeSourceOrError()
	if err != nil {
		return nil, err
	}
	return storeSource.GetAllProxies()
}

func (m *serviceConfigManager) GetStoreProxy(name string) (v1.ProxyConfigurer, error) {
	if name == "" {
		return nil, fmt.Errorf("%w: proxy name is required", configmgmt.ErrInvalidArgument)
	}

	storeSource, err := m.storeSourceOrError()
	if err != nil {
		return nil, err
	}

	cfg := storeSource.GetProxy(name)
	if cfg == nil {
		return nil, fmt.Errorf("%w: proxy %q", configmgmt.ErrNotFound, name)
	}
	return cfg, nil
}

func (m *serviceConfigManager) CreateStoreProxy(cfg v1.ProxyConfigurer) (v1.ProxyConfigurer, error) {
	if err := m.validateStoreProxyConfigurer(cfg); err != nil {
		return nil, fmt.Errorf("%w: validation error: %v", configmgmt.ErrInvalidArgument, err)
	}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Pass a non-empty, exact proxy name: GET /api/store/proxies/my-tcp-proxy.
  2. Trace where the empty name comes from (unset env var, empty JSON field) and fix the producer.
  3. List names first with GET /api/store/proxies to confirm valid identifiers.

Example fix

# before
name=""
curl http://127.0.0.1:7400/api/store/proxies/$name   # 400 proxy name is required

# after
name="ssh-tunnel"
curl http://127.0.0.1:7400/api/store/proxies/$name
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(name) == "" {
    return fmt.Errorf("proxy name must be non-empty")
}
p, err := mgr.GetStoreProxy(name)

Try / catch

if _, err := mgr.GetStoreProxy(name); err != nil {
    if errors.Is(err, configmgmt.ErrInvalidArgument) { /* fix caller: empty/bad name */ }
    if errors.Is(err, configmgmt.ErrNotFound) { /* no such proxy */ }
}

Prevention

When it happens

Trigger: Calling the Go method GetStoreProxy("") directly, or hitting the admin route with an empty name segment (URLs like /api/store/proxies/ or /api/store/proxies/%20 that decode to empty).

Common situations: Scripts building the URL by string concatenation with an unset variable: /api/store/proxies/$PROXY_NAME with PROXY_NAME empty; Go client code passing a struct field that was never populated.

Related errors


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