fatedier/frp · error

proxy name [%s] is already in use

Error message

proxy name [%s] is already in use

What it means

The server-side proxy Manager rejects Add() when a proxy with the same name already exists in its process-wide map. Proxy names must be unique across the whole frps instance, not just per client or per user. The error is returned while handling the client's NewProxy request, so the proxy fails to start.

Source

Thrown at server/proxy/proxy.go:588

type Manager struct {
	// proxies indexed by proxy name
	pxys map[string]Proxy

	mu sync.RWMutex
}

func NewManager() *Manager {
	return &Manager{
		pxys: make(map[string]Proxy),
	}
}

func (pm *Manager) Add(name string, pxy Proxy) error {
	pm.mu.Lock()
	defer pm.mu.Unlock()
	if _, ok := pm.pxys[name]; ok {
		return fmt.Errorf("proxy name [%s] is already in use", name)
	}

	pm.pxys[name] = pxy
	return nil
}

func (pm *Manager) Exist(name string) bool {
	pm.mu.RLock()
	defer pm.mu.RUnlock()
	_, ok := pm.pxys[name]
	return ok
}

func (pm *Manager) Del(name string) {
	pm.mu.Lock()
	defer pm.mu.Unlock()
	delete(pm.pxys, name)
}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Give every proxy a globally unique name across all clients (prefix with hostname or user)
  2. Check for a duplicate or stale proxy with the same name in the dashboard/API and stop the other client
  3. If it happens right after a reconnect, wait for the old control to time out or restart the conflicting frpc

Example fix

# before (two clients both use)
[[proxies]]
name = "web"

# after (unique per client)
[[proxies]]
name = "host1-web"
Defensive patterns

Strategy: validation

Validate before calling

// Client-side: derive a globally unique proxy name before start.
host, _ := os.Hostname()
name := host + "-" + baseProxyName
if seen[name] { /* refuse to start, another local proxy uses it */ }

Try / catch

if err := pm.Add(name, pxy); err != nil {
    if strings.Contains(err.Error(), "already in use") {
        // pick a new name or surface a clear config error; retrying unchanged will fail
    }
}

Prevention

When it happens

Trigger: Two clients (or two proxy blocks in one client) both declare a proxy named "web"; a client reconnects and re-registers before the previous control's cleanup removed the old proxy; the same client config is run twice against one server.

Common situations: Copying a client config to a second machine without renaming proxies; running the same frpc config twice; race after an unstable connection where the stale proxy has not yet been released.

Related errors


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